A let expression
let declList in exp;;exp end
allows you to introduce local declarations that
are valid only in expressions
exp;;exp.
This expression is evaluated as follows.
-
1.
Each declaration in declList is evaluated sequentially
and adds the resulting environment to the current environment.
-
2.
Under the augmented environment, expressions
exp;;exp are evaluated in
this order.
-
3.
The type and value of the last expression is those of this
entire expression.