let
x = 10
in
x * x
;;
let y =
let
x = 10
in
x * x
;;
let rec filter f xs =
if xs = [] then
[]
else
let h = List.hd xs in
let t = filter f (List.tl xs) in
if (f h) then h::t else t
;;
let x1 = e1 in
let x2 = e2 in
e
;;
let x1 = 1 in
let x2 = 2 in
let x3 = 3 in
let x4 = 4 in
(x1 + x2 + x3 + x4)
;;
let x = 1 in
let x = 2 in
let x = 3 in
let x = 4 in
let x = (x + x + x + x)
;;
let x = 10 in
let y = 20 in
x = x * y
;;
let
x = 10
in
(let
y = 20
in
x * y)
+ x
;;
let x = 10 in
let y = 20 in
x * y
;;
let f x = 30 + x;;
(f 0)
(int -> int) -> (int -> int)
let deriv f = fun x -> (f x) - (f (x-1))/x
(* nested-let-expressions *)
let f (z : int) =
let x = if z > 0 then z else 34 in
let y = x + 9 in
x + (let q = y+2 in hd [q])
;;
let rec filter f l =
if (l=[]) then []
else
let h = hd l in
let t = filter (f, tl l) in
if (f h) then h::t else t
;;
let a = 20;;
let f x =
let y = 10 in
let g z = y + z in
a + (g x)
;;
f 0;;
(* nested-let-expressions *)
let f (z : int) =
let x = if z > 0 then z else 34 in
let y = x + 9 in
x + (let q = y+2 in hd [q])
;;
let a = 20;;
let f x =
let y = 10 in
let g z = y + z in
a + (g x)
;;
f 0;;
let a = 20;;
let f x =
let a = 10 in
let g z = a + z in
a + (g x)
;;
f 0;;