Design patterns·Functional ideas that went mainstream
you built a pipeline over a million rows, took the first ten, and only about ten rows were ever processed.
Lazy evaluation
Also calledcall by need, lazy sequence, deferred evaluation
Deferring computation until its result is needed, and not computing it at all if it never is. It makes infinite sequences expressible, makes early-exit pipelines cheap, and makes performance depend on when a value is forced rather than on where it is written. That last part is also its cost: in a lazy pipeline, exceptions and effects happen somewhere other than where they appear to.