|Steele and Sussman||March 10, 1976||5||LAMBDA: The Ultimate Imperative|
Lambda calculus (and related languages, such as "pure LISP") is often used for modelling the applicative constructs of programming languages. However, they are generally thought of as inappropriate for modelling imperative constructs. In this section we show how imperative constructs may be modelled by applicative SCHEME constructs.
The simplest kind of imperative construct is the statement sequencer, for example the compound statement in ALGOL:
This construct has two interesting properties:
- It performs statement S1 before S2, and so may be used for sequencing.
- S1 is useful only for its side effects. (In ALGOL, S2 must also be a statement, and so is also useful only for side effects, but other languages have compound expressions containing a statement followed by an expression.)
The ALGOL compound statement may actually contain any number of statements, but such statements can be expressed as a series of nested two-statement compounds. That is:
is equivalent to: