chickadee » scheme » delay

(delay <expression>)syntax

The delay construct is used together with the procedure force to implement lazy evaluation or call by need. (delay <expression>) returns an object called a promise which at some point in the future may be asked (by the force procedure) to evaluate <expression>, and deliver the resulting value. The <expression> may return multiple values, which will be correctly memoized and returned by subsequent calls to force. This is a CHICKEN extension to R5RS.

See the description of force (under Control features, below) for a more complete description of delay.

CHICKEN also supports the R7RS delay-force syntax which allows for iterative lazy algorithms to be expressed in bounded space. See the Lazy evaluation section in the (chicken base) module documentation for more information.