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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access