Commit 55f38f26 authored by Taddeus Kroes's avatar Taddeus Kroes

funclang series3: Prettified ass 7.5 (map).

parent e3902d0a
...@@ -23,7 +23,11 @@ let zip l m = ...@@ -23,7 +23,11 @@ let zip l m =
;; ;;
(* 4 *) (* 4 *)
let rec map f l = if length l = 0 then [] else (f (hd l))::(map f (tl l));; let rec map f l =
match l with
| [] -> []
| h::t -> f h::map f t
;;
(* 5 *) (* 5 *)
let rec reduce f z l = let rec reduce f z l =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment