Posts Tagged ‘lambda’

OCaml and -dlambda #1

Hi,
Have you ever tried compiling with either ocamlc or ocamlopt with the -dlambda option ?
Compiling the following code :

?View Code OCAML1
2
3
4
5
let f = List.map (fun x -> x+1)
 
let print_list = List.iter (fun x -> Printf.printf " %d " x)
 
let _ = print_list ( f [1;2;3;4;5] )

give the following “lambda code” :

?View Code LAMBDA1
2
3
4
5
6
7
8
9
10
11
12
13
(* $ ocamlc [...]