In programming language theory, lazy evaluation, or call-by-need,is an evaluation strategy which delays the evaluation of an expression until its value is needed (non-strict evaluation) and which also avoids repeated evaluations (sharing).
The benefits of lazy evaluation include:
- The ability to define control flow (structures) as abstractions instead of primitives.
- The ability to define potentially infinite data structures. This allows for more straightforward implementation of some algorithms.
- The ability to define partially-defined data structures where some elements are errors. This allows for rapid prototyping.
Lazy evaluation is also a thing in Eigen.
The most obvious example is through PyTorch.