csci2041/public-class-repo/SamplePrograms/Sec_10_3:35pm/map.ml
Michael Zhang 399845160c
f
2018-01-29 17:35:31 -06:00

11 lines
174 B
OCaml

(* map : ('a -> 'b) -> 'a list -> 'b list *)
let inc x = x + 1
let rec map f l =
match l with
| [] -> []
| a::rest -> f a :: map f rest
let r = map inc [1;2;3;4] ;