Local variables can be bound with the let construct. The syntax is:
The semicolon separates bindings (the square brackets indicate an optional term of the syntax). Each pattern is either a variable name or a pattern based on a record name. Each expbind binds the variables in the pattern on the left of the = to the result of the expression on the right. For example:
Here a is bound to 7, then the pattern (b, c) is matched with the result of the expression on the right so that b is bound to 1 and c is bound to 2. Patterns can be nested, and the patterns are matched recursively.
The variables in each expbind can be used in the expressions (exp) of any later expbind (the bindings are done serially). For example, in the expression
the variable a is bound to the value 7 and then the variable b is bound to the value of a plus 4, which is 11. When these are multiplied in the body, the result is 77.