Comment by Spivak
12 days ago
This is less wat. when you write it like
eager:
for item in loop():
item()
lazy:
items = []
for item in loop():
items.append(item)
for item in items:
item()
Each next() into loop increments a shared counter so when you print it out as you go it 1, 2, 3 but when you print it out once you've called it a bunch is 9, 9, 9.
No comments yet
Contribute on Hacker News ↗