Chapter 11Lazy Sequences

Larry Wall, the creator of Perl, is famous for saying that the three virtues of a good programmer are laziness, impatience, and hubris. People tend to only remember the part about laziness, perhaps because impatience and hubris are so easy to come by. But Larry Wall is right: laziness is a great thing. Since there’s always more to do than you can ever possibly get to, wise programmers save their strength for the tasks that are absolutely necessary.

What is true for programmers is frequently also true for programs. There’s a lot of programmatic mileage to be gained by not running off and computing every value in sight the moment it comes into view. It turns out that laziness—the programmatic variety—is more than just ...

Get Getting Clojure now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.