Standard ML of New Jersey (32-bit) v110.99 [built: Thu Dec 24 11:01:10 2020] - - fun f x = x*x; val f = fn : int -> int - f 4; val it = 16 : int - f 5; val it = 25 : int - - fun f x y z = x + y + z; val f = fn : int -> int -> int -> int - f 1 2 3; val it = 6 : int - f 1; val it = fn : int -> int -> int - val g = f 1; val g = fn : int -> int -> int - g 3 4; val it = 8 : int - - f 1 2; val it = fn : int -> int - - val h = f 1 2; val h = fn : int -> int - h 5; val it = 8 : int - - - - fun f1 x y z = x + y + z; val f1 = fn : int -> int -> int -> int - val f2 = fn x => fn y => fn z => x + y + z; val f2 = fn : int -> int -> int -> int - - - f1; val it = fn : int -> int -> int -> int - f2; val it = fn : int -> int -> int -> int - - - - - val makeAdder = fn x => fn y => x+y; val makeAdder = fn : int -> int -> int - val add5 = makeAdder 5; val add5 = fn : int -> int - add5 6; val it = 11 : int - add5 7; val it = 12 : int - add5 2; val it = 7 : int - val add10 = makeAdder 10; val add10 = fn : int -> int - add10 6; val it = 16 : int - - - - - - fun g a b = 2*a + 3*b; val g = fn : int -> int -> int - g 4; val it = fn : int -> int - - val k = g 4; val k = fn : int -> int - k 1; val it = 11 : int - - - - - - fun f1 x y z = x + y + z; val f1 = fn : int -> int -> int -> int - val f2 = fn x => fn y => fn z => x+y+z; val f2 = fn : int -> int -> int -> int - - - f 1; val it = fn : int -> int -> int - - - - fun bob u v = u @ v; val bob = fn : 'a list -> 'a list -> 'a list - bob [1,2,3,4]; val it = fn : int list -> int list - val alice = bob [1,2,3,4]; val alice = fn : int list -> int list - - alice [10,11,12]; val it = [1,2,3,4,10,11,12] : int list - alice [7,8,9]; val it = [1,2,3,4,7,8,9] : int list - - val alice2 = bob [10,20,30]; val alice2 = fn : int list -> int list - alice2 [1,2,3]; val it = [10,20,30,1,2,3] : int list - - - - fun g x y = x + y; val g = fn : int -> int -> int - -