Solution (source code)

= Solution

<Lazy evaluation> is evaluation by need: an expression is deferred until its value is demanded, and its computed value is shared for subsequent demands of the same suspended computation.

Its two key properties here are \b[avoiding evaluation of unused expressions] and \b[sharing demanded computations]. For example, the first component of `(3, undefined)` can be obtained without evaluating the second. A suspended expression is represented by a <thunk>; after evaluation its result can be reused. This supports productive infinite <lists>: `take 5 [0..]` demands only a finite prefix. It does not guarantee that a demanded computation terminates.