let x = 132;;
let f x =
let x = 15 in (fun x -> print_int x) 150;;
f 2;;
The output is 150.
My question is: why "print_int" does not perform yet? is that because fun x-> print_int x just defines a function, but not required to perform yet? Does the inside function just simply print 15?
I wanted to respond to my guess, and when I modify the code to this:
# let x = 132;;
val x : int = 132
# let f x =
let x = 15 in (let g x = print_int x) 150;;
Error: Syntax error
an error is prompted. Why? (I was just trying to name the function "g", but syntax error?)
Anyone can help? thx