You asked about the evaluation order in the expression let x=1 in let x=x+2 in .... Order from left to right! When you have a chain let a=b in let c=d in ..., the evaluation order is always from left to right.
: x let. , , let x=x+1, , "" x " x". "" "x" , OCAML! , , , ,
let x = 1 in let y = x+2 in let z = y+3 in z;;
, . ( let.) "x" , x, y z. . .
? " x = 1 y = x + 2", " x = 1 x = y + 2"? x=x+2 ! , let x=aaa in bbb.
let x=aaa in bbb
, aaa,
(fun x -> bbb) aaa
, : -, OCAML "bbb" , "aaa" . ( let x=aaa in bbb , aaa, bbb, " ".) -, "x" "x" "aaa" . , "aaa" "x" , , "x" . .
:
let x=1 in let x=x+2 in let x=x+3 in x
(fun x -> let x=x+2 in let x=x+3 in x) 1
let :
(fun x -> (fun x -> let x=x+3 in x) x+2 ) 1
(fun x -> (fun x -> (fun x-> x) x+3) x+2 ) 1
, :
(fun x -> (fun y -> (fun z -> z) y+3) x+2 ) 1
,
let x=1 in let y=x+2 in let z=y+3 in z
, .