Hacker News new | ask | show | jobs
by wyager 4384 days ago
Compare the code you wrote with what I wrote.

Lazy evaluation gets you all that, with no extra code, all the time.

Imagine writing that iterator stuff for every single applicable thing in the entire program. There are also other places where lazy evaluation is useful and you can't use iterators, like a function that will only use a portion of its arguments depending on some condition.