Ocaml 中的关键字 "in"

Keyword "in" in Ocaml

我不明白这段代码是如何获取“z”的值的:

let outer x y =
  let inner z = x + z
  in inner y ;;

一般来说,当我们有多个函数时,我无法理解“in”子句是如何工作的。

注意 let inner z = x + z 等价于(或语法糖)

 let inner = fun z -> x + z

参考Ocaml手册the Chapter 1 - the core language and section §7.7 Expressions

因此您的 inner y 函数应用程序(在最后一行)将 z 绑定到 y 的值 ...