Chapter 12
Lazy Evaluation
By using functions as values, it becomes possible to replace data with a function that computes this data. With this approach, the evaluation of arguments can be delayed until they are needed, making it possible to pass unevaluated code to methods and functions. Combined with syntactic help from the language, it becomes possible to define additional control structures from within a programming language, leading potentially to the definition of an internal domain-specific language. Functions can also be stored within data structures to delay the evaluation of parts of that structure. Streams are a classic functional programming structure that implements lazily evaluated sequences. Besides unevaluated arguments and ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access