REDUCE

3.5 Proper Statements as Expressions

Several kinds of proper statements deliver an algebraic or numerical result of some kind, which can in turn be used as an expression or part of an expression. For example, an assignment statement itself has a value, namely the value assigned. So

        2 * (x := a+b)

is equal to 2*(a+b), as well as having the “side-effect” of assigning the value a+b to X. In context,

        y := 2 * (x := a+b);

sets X to a+b and Y to 2*(a+b).

The sections on the various proper statement types indicate which of these statements are also useful as expressions.