Lazy list
A lazy list is an immutable sequence whose elements and continuation are computed incrementally on demand, allowing finite or infinite sequences.
Clojure: The Essential Reference
A lazy sequence is a sequence whose elements are computed incrementally as they are requested.
- How it is used
- Uses incremental generation and processing to obtain a finite portion of large or infinite sequences.
- How deep it goes
- Explains delayed evaluation, caching, recursive construction, realization costs, head retention, and stack-overflow cases.
- Examples
- Uses infinite ranges, eager-versus-lazy mapping, prime generation, regular-expression matches, and JDBC rows.
- What you can do after
- Build it from scratch with `lazy-seq` and `cons`, and diagnose when consumption retains memory or outlives a resource.
Read how Clojure: The Essential Reference explains lazy list →
Functional Programming in Scala, Second Edition
A lazy list is an immutable sequence whose elements and continuation are evaluated on demand, allowing finite or infinite sequences.
- How it is used
- Uses demand-driven sequences to fuse transformations, avoid unnecessary allocation, and represent infinite computations.
- How deep it goes
- Explains thunk-based representation, selective forcing, stack safety, core operations, and stateful generation.
- Examples
- Demonstrates finite prefixes, infinite integer and constant streams, Fibonacci numbers, transformation chains, and REPL conversion with toList.
- What you can do after
- Build it from scratch using Scala thunks, lazy constructors, recursive operations, and unfold-based generators.
Read how Functional Programming in Scala, Second Edition explains lazy list →
Related concepts
- rangeproduced by · A language or API construct that represents or generates an ordered sequence or interval of values, with its bounds and any step interpreted according to that language or API.
- re-seqproduced by · re-seq is a Clojure function that returns a lazy sequence of matches for a regular expression in a string.
- takeused by · Take is an operation that limits output to at most a specified number of leading elements or emitted values from a sequence or stream.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

