let rec member el = function [] -> false h :: t -> h = el or member el t let rec add_end el = function [] -> [el] h :: t -> h :: (add_end el t) let rev = let rec rev2 res = function [] -> res h :: t -> rev2 (h :: res) t in rev2 [] let rec iter f = function [] -> () h :: t -> (f h; iter f t) let rec map f = function [] -> [] h :: t -> f h :: map f t ;; iter print_int [1;2;3];; map (fun x -> x + 2) [3; 7; 4] ;;
This document was generated using caml2html