はてなキーワード: Objective Camlとは
Objective Camlを使ってみたよ!
問3はわからなかった!
let rec map f ls = match ls with hd::tl -> f hd (map f tl) | [] -> 0 in let plus x y= x + y in let rec iter f n ls= match ls with hd::tl -> (iter f (f n hd) tl) | _ -> n in let biggest ls= match ls with hd::tl -> iter (fun x y -> if x > y then x else y) hd tl | _ -> assert false in print_int(map plus [1; 4; 5]); print_int(biggest [1; 4; 32; 523; 453; 23;])