Value of bindings in SML?
问题 can someone please explain why is "ans" is bound to value of 16 in here after evaluation - this is a correct answer? I thought the answer 3 since we're calling function f and sending values 1 and 2 as function f doesn't also see the values 5 and 10 but I guess I am wrong. val x = 1 val y = 2 val f = fn y => x + y val x = 5 val y = 10 val ans = f x + y 回答1: What you are seeing is sometimes called lexical scoping . The function f was defined in the scope of a certain binding for x , that scope