Standard ML of New Jersey (32-bit) v110.99 [built: Thu Dec 24 11:01:10 2020] - map length [[2,3,5], [4], [6,7,4,3], [4,4]]; val it = [3,1,4,2] : int list - - map hd [[2,3,5], [4], [6,7,4,3], [4,4]]; val it = [2,4,6,4] : int list - - map tl [[2,3,5],[4],[6,7,4,3],[4,4]]; val it = [[3,5],[],[7,4,3],[4]] : int list list - - - map (map (fn x=>x+3)) [[2,3,5], [4], [6,7,4,3], [4,4]]; val it = [[5,6,8],[7],[9,10,7,6],[7,7]] : int list list - - map (fn x => x+2) [1, 3, 6, 3, 9]; val it = [3,5,8,5,11] : int list - - map String.size ["cats", "dog", "apple", "pear"]; [autoloading] [library $SMLNJ-BASIS/basis.cm is stable] [library $SMLNJ-BASIS/(basis.cm):basis-common.cm is stable] [autoloading done] val it = [4,3,5,4] : int list - - - fun f x y z = 2*x + 3*y + 4*z; val f = fn : int -> int -> int -> int - - - val g1 = f 5; val g1 = fn : int -> int -> int - - g1 2 1; val it = 20 : int - - val g6 = f 5 4; val g6 = fn : int -> int - - g6 1; val it = 26 : int - g6 2; val it = 30 : int - - - - fun g5 u v = f u v 5; val g5 = fn : int -> int -> int - g5 2 3; val it = 33 : int - val g6 = f 5 4; val g6 = fn : int -> int - - - (fn x => x+2) ((fn x => 3*x) 5); val it = 17 : int - - - (fn x => (fn y => x (x y))) (fn w => 3*w) 4; val it = 36 : int - - - foldr (fn (x, y) => if (0 = x mod 2) then x+y else y) 0 [1,2,3,4,5,6]; val it = 12 : int - foldr (fn (x, y) => if (0 = x mod 2) then x+y else y) 0 [1,2,3,4,5,6,3,3,3,3]; val it = 12 : int - foldr (fn (x, y) => if (0 = x mod 2) then x+y else y) 0 [1,2,3,4,5,6,3,3,3,3,100]; val it = 112 : int - foldr (fn (x, y) => if (1 = x mod 2) then x+y else y) 0 [1,2,3,4,5,6,3,3,3,3,100]; val it = 21 : int -