How to add laziness to a strict language without even being odd
Philiip Wadler, Walid Taha, David B. MacQueen · 1998
This note explicates two styles of lazy programming, showing how one (called "odd") is easy to encode in the traditional `delay' and `force' syntax, but forces too much evaluation, while the other (called "even") delays evaluation as in traditional lazy languages, but is harder to encode. It presents a new `lazy' syntax, and shows how the even style is easy to encode in this syntax, while the odd style is harder to encode. The new `lazy' syntax is defined by translation into the `delay-force' syntax. Comparisons are drawn with two other syntaxes, one used in CAML and one proposed by Chris Okasaki, and a prototype implementation in SML/NJ is described. 1 Introduction It's easy to add laziness to a strict language. A number of schemes have been proposed, all variants of the following idea: add a type constructor for suspensions, and language constructs to delay and force evaluation. e : t delay e : t susp e : t susp force e : t The delayed expression is not evaluated unless the c...