lazy evaluation

Related Overviews


'lazy evaluation' can also refer to...


More Like This

Show all results sharing this subject:

  • Computing


Show Summary Details

Quick Reference

An execution mechanism in which an object is evaluated only at the time when, and to the extent that, it is needed. This allows programs to manipulate objects, such as lengthy or infinite lists, whose evaluation would otherwise be needlessly time-consuming or indeed fail to terminate at all. An illustration is the problem of comparing two trees, t1 and t2, to test whether the leaves of t1, read from left to right, form the same list as the leaves of t2. The simplest solution is first to construct the two leaf-lists and then to compare them element by element. Lazy evaluation allows this program to interleave the construction of the two leaf-lists and then test for equality. The program can then terminate as soon as the lists are found to differ, without having unnecessarily constructed both lists in toto. See also strictness.

Subjects: Computing.

Reference entries

Users without a subscription are not able to see the full content. Please, subscribe or login to access all content.