This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Block apply := method(target, args, | |
args = if(args isNil, list(), args) | |
target = if(target isNil, scope, target) | |
self setScope(target) | |
self performWithArgList("call", args) | |
) | |
Block bind := method( | |
args := call message argsEvaluatedIn(call sender) | |
target := args at(0) | |
args = args slice(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Block apply := method(target, args, | |
args = if(args isNil, list(), args) | |
target = if(target isNil, scope, target) | |
self setScope(target) | |
self performWithArgList("call", args) | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Block bind := method( | |
args := call message argsEvaluatedIn(call sender) | |
target := args at(0) | |
args = args slice(1) | |
b := self | |
return block( | |
b apply(target, args union(call message argsEvaluatedIn(call sender))) | |
) | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Block curry := method( | |
args := call message argsEvaluatedIn(call sender) | |
if(args size < 1) then ( | |
return self | |
) | |
/* | |
target := args at(0) | |
args = args slice(1) | |
*/ | |
b := self |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stream := Object clone do ( | |
create := method(car, cdr, | |
stream := self clone | |
stream setSlot("_car", car) | |
stream setSlot("_cdr", cdr) | |
stream | |
) | |
car := method(_car) | |
cdr := method(_cdr call) | |
each := method(_block, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stream := Object clone do ( | |
create := method(car, cdr, | |
stream := self clone | |
stream car ::= car | |
stream cdr ::= cdr | |
stream | |
) | |
each := method(k, | |
k call(car) | |
cdr each(k) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hoge | |
import scala.tools.nsc.Interpreter | |
import scala.tools.nsc.InterpreterResults.Result | |
import scala.tools.nsc.Settings | |
class User(id:Int, name:String) { | |
def id():Int = { id } | |
def name():String = { name } | |
override def toString():String = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// io like println | |
class ConsolePrint(o:Any) { | |
def println = { Console.println(o) } | |
} | |
implicit def thisPrintln(n:Any) = { new print(n) } | |
"hello world" println // => "hello world" | |
(123 * 456) println // => 56088 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Atmosphere example: Hello world | |
// | |
package sample.hoge; | |
import javax.ws.rs.GET; | |
import javax.ws.rs.Path; | |
import javax.ws.rs.Produces; |
OlderNewer