liveBook · Manning

Infinite data structure

An infinite data structure represents or generates an unbounded number of elements, commonly by producing them lazily rather than storing them all.

How 2 Manning books explain it

Clojure: The Essential Reference

An infinite sequence is a sequence with unboundedly many elements, typically generated on demand.

How it is used
Supplies unbounded inputs for sequential processing, evolving states, and on-demand work generation.
How deep it goes
Defines generator contracts and exceptions, works through stateful examples, and demonstrates memory and performance consequences of laziness.
Examples
Demonstrates Fibonacci pairs, a pi approximation, Game of Life states, random values, and lazy worker batches.
What you can do after
Build it from scratch with lazy-seq and cons, or apply it via iterate to generate and consume successive states.

Read how Clojure: The Essential Reference explains infinite data structure →

Learn Haskell by Example

An infinite list is a lazily generated list with no finite endpoint whose finite prefixes can be evaluated on demand.

How it is used
Builds reusable signal-processing curves without calculating their lengths in advance.
How deep it goes
Explains lazy generation, safe finite-demand operations, recursive definitions, range syntax, and the failure of full evaluation.
Examples
Demonstrates recursive ones, natural and odd-number ranges, repeat, finite zipping, and an ADSR audio envelope.
What you can do after
Apply it via take, repeat, range syntax, zipWith, and zipWith3 while avoiding operations that demand complete evaluation.

Read how Learn Haskell by Example explains infinite data structure →

Related concepts

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.