[Home]Lazy evaluation

HomePage | Recent Changes | Preferences

A variable?, when lazily evaluated?, is not evaluated as soon as it gets bound to another variable, but when something tells the evaluator to produce the variable's value?. This means that lazy evalutation allows programmers to produce infinite sequences without pushing the evalutator into an endless loop, and other neat things.

In Scheme, lazily evalutated (in Scheme jargon, "delayed") variables are produced by using

    (define delayed-variable (delay variable))

Then, (force delayed-variable) yields the value of variable.

There are some programming languages where variables are lazily evaluated by default. Haskell is one such language.


HomePage | Recent Changes | Preferences
This page is read-only | View other revisions
Last edited September 26, 2001 6:46 pm by AndreasFuchs (diff)
Search: