Skip to content

Lazy Evaluation

Deferring computation until its result is actually needed avoids wasting work on values that may never be used; trades potential latency at use-time for guaranteed savings on unused values

Tension Addressed

Generality vs. Optimization

Recognizable As

Lazy loading, deferred execution, generators/iterators, copy-on-write, demand paging

Canonical Sources

Henderson & Morris, "A Lazy Evaluator" (1976); Hughes, "Why Functional Programming Matters" (1989)

Transfers To

Functional programming, operating system memory management, database query optimization

The inverse of precomputation - instead of computing everything upfront, compute nothing until required. Particularly valuable when only a subset of possible computations will be needed.