Distinguishes between learning activities:
And summative assessments:
The imperative versus functional schism?
Being effect-free or pure has advantages by being independent of how a machine evaluates expressions (i.e., called referential transparency).
\[ \begin{array}{rcl} (1 + 1) + (1 + 1) & \longrightarrow& 2 + (1 + 1) \\ & \longrightarrow& 2 + 2 \\ & \longrightarrow& 4 \end{array} \]
Examples?
An expression can be a literal or consist of operations that await to be evaluated. For example, here are some expected expressions:
We can check that an expression has the expected type as follows:
Type checking works by making sure all operations in all sub-expressions have the “expected type”.
Since the unit value ()
itself is uninteresting and usually associated with side-effecting expression, the printer in the above simply chooses to not print unit values.