## 4.1 Lambda Expressions and Local Assignments
TBoS p.70-71, p.85-87
(λ x (* x x)) is written as '(/. X (* X X))' in Shen. It is customary to use capital letters for
variables. '(/. X Y Z (+ X Y Z))' is an acceptable abbreviation for '(/. X (/. Y (/. Z (+ X Y Z))'. You can also
write '(lambda X (+ X X))' though this form does not sustain abbreviations, '(lambda X Y (+ X Y))' is not legal
(it should be '(lambda X (lambda Y (+ X Y)))').
Local assignments are made using 'let'. 'let' takes a variable v, an expression e_{1}1 and
an expression e_{2} and binds v to the normal form of e_{1} in the evaluation of e_{2}.
'let' is polyadic;
(let X_{1} a_{1} ... X_{n} a_{n} Y)
is short for
(let X_{1} a_{1} ...
(let X_{n} a_{n}) Y). |