We may earn an affiliate commission when you visit our partners.

Lazy Evaluation

Save
May 1, 2024 Updated November 14, 2026 18 minute read

Lazy evaluation is a fascinating and powerful concept in computer science, particularly prominent in functional programming languages. At its core, lazy evaluation is an evaluation strategy that delays the computation of an expression until its value is actually needed. This approach contrasts sharply with eager evaluation (also known as strict evaluation), where expressions are evaluated as soon as they are bound to a variable. Imagine preparing ingredients for a complex recipe: eager evaluation is like chopping all your vegetables and measuring all your spices before you even turn on the stove, while lazy evaluation is like prepping each ingredient just before it's required in a step. This fundamental difference has profound implications for how programs are written and how they perform.

Share

Help others find this page about Lazy Evaluation: by sharing it with your friends and followers:

Reading list

We've selected 18 books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Lazy Evaluation.
Demonstrating why call-by-need lazy evaluation and memoized thunks are essential for achieving amortized O(1) persistence in functional queues, streams, and heaps, Chris Okasaki's landmark book formalizes the banker's and physicist's methods for analyzing lazy suspensions.
Detailing how graph reduction and combinator compilation execute non-strict expressions without premature evaluation, Simon Peyton Jones lays the foundational blueprint for lazy functional language compilers.
Understanding weak head normal form (WHNF) versus normal form (NF), thunk evaluation strategies (Eval monad and Par monad), and how to diagnose space leaks in lazy evaluation is central to Part I of GHC co-author Simon Marlow's practical guide.
Chapters 3.5 and 4.2 provide one of the most illuminating treatments of delayed evaluation in computer science, building infinite streams of primes and power series with delay/force memoization and transforming a strict Scheme interpreter into a normal-order lazy evaluator.
Chapter 15 provides a crystal-clear undergraduate introduction to innermost versus outermost reduction orders, call-by-value versus call-by-name sharing (call-by-need), infinite Sieve of Eratosthenes streams, and strict application ($!).
Chapter 5 of the famous Red Book (updated for Scala 3) is entirely devoted to strictness and laziness inside an otherwise strict JVM language, guiding readers to build lazy lists (streams) from scratch using call-by-name parameters and lazy val memoization.
Bringing demand-driven lazy evaluation to mainstream imperative developers, Luciano Ramalho explains how Python generator functions (yield), generator expressions, and the itertools module process multi-gigabyte data pipelines in O(1) memory.
Profiling laziness, space leaks, and streaming I/O in production Haskell applications, O'Sullivan, Goerzen, and Stewart show how strictness annotations and lazy ByteStrings balance memory with composability.
Demystifying infinite lists, lazy folds, and demand-driven recursion with humor and intuition, Miran Lipovaca gives self-learners an approachable entry point into non-strict functional evaluation.
Separating pure calculations from side-effecting actions so data pipelines stay composable, Eric Normand equips working engineers with the mental model behind deferred, demand-driven computation.
Showcasing how modern DataFrame engines use LazyFrame query plans to defer execution, apply predicate and projection pushdown, and stream datasets larger than RAM, Janssens and Nieuwdorp bring lazy evaluation to data engineering.
Demonstrating lazy streams, Conduit pipelines, and strictness control across practical recipes, Yogesh Sajanikar helps working Haskell developers harness non-strict evaluation without falling into memory traps.
Illustrating how non-strict semantics decouple data producers from consumers, Oxford professor Richard Bird teaches equational reasoning, infinite cyclic structures, foldl versus foldl' space-leak trade-offs, and wholemeal program calculation.
Just-in-Time (JIT) pull manufacturing—where downstream stations signal demand via Kanban cards and upstream stations produce zero inventory until requested—is the exact physical industrial analogue to call-by-need lazy stream evaluation and backpressure.
Introducing lambda lifting and the G-machine (Graph reduction machine) for compiling Lazy ML into fast native machine code, Thomas Johnsson's pioneering work proved that call-by-need languages could rival strict languages in execution speed.
Formalizing persistent queues, lazy streams, and amortized functional data structures in Isabelle/HOL, Tobias Nipkow and coauthors bridge Okasaki-style lazy data structures with machine-checked correctness proofs.
Addressing the practical engineering pitfalls of lazy evaluation in production—such as lazy I/O file-handle exhaustion, space leaks from unevaluated accumulator thunks, BangPatterns, and StrictData pragmas—Rebecca Skinner equips working developers.
Through thirty algorithmic design pearls, Richard Bird showcases how lazy evaluation enables elegant divide-and-conquer, tie-the-knot circular programming, and demand-driven tree pruning without interleaving control flow and data generation.
Table of Contents
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser