Lazy Evaluation.
Space leaks
Haskell evaluates lazily: expressions are computed only when needed. This allows infinite structures, but careless folding can cause space leaks.
Infinite list thanks to lazy evaluation:
Space leak vs. strict fold:
Space leaks
Haskell evaluates lazily: expressions are computed only when needed. This allows infinite structures, but careless folding can cause space leaks.
Infinite list thanks to lazy evaluation:
Space leak vs. strict fold: