fun sumupto (n: int) : int = if (n = 0) then 0 else n + sumupto (n - 1) ; fun maplist (f: 'a -> 'b, li: 'a list) : 'b list = case li of nil => nil | hl::tl => f(hl)::maplist(f,tl) ; (* - use "sum+map.ml" ; [opening sum+map.ml] val sumupto = fn : int -> int val maplist = fn : ('a -> 'b) * 'a list -> 'b list val it = () : unit - sumupto(100) ; val it = 5050 : int - maplist(sumupto,[3,10,0]) ; (* = mapList(sumupto,3::10::0::nil) *) val it = [6,55,0] : int list - maplist(not, [true,false]) ; val it = [false,true] : bool list *)