+ y ;; let x = add 1 2 ;; let add1 = add 1 ;; let y = add1 10 ;; let app f x = f x ;; let z = app (fun x => x + 1) 1 ;; let num_to_str n: int = java.lang.Integer##toString(n) ;; } ؔఆٛͱݺͼग़͠ ෦ద༻ Javaϝιουݺͼग़͠ ߴ֊ؔ
// id: [?1] ?1 -> ?1 data Option a = Some a | None ;; let get_or_else o x = match o | Some a => a | None => x ;; let option_value = Some 1 ;; let value = get_or_else option_value 100 ;; } ύϥϝʔλଟ૬ ܕਪ ଟ૬ͳతσʔλܕ ύλʔϯϚον
x + y class A$0 extends Fun { def app(x: Object) = return new A$1( local=x, parent=this) } class A$1 extends Fun { def app(arg: Object) = { val x = (int)parent.local; val y = (int)arg; x + y } }
x g x = f x in f val env = Array[Object](null, null) val f = A$0(env, null) val g = A$1(env, null) env(0) = f env(1) = g return f // f.local(0) == f, f.local(1) == g