coffeescript
coffeescript copied to clipboard
Add lazy comprehensions
Resolves #5379
Adds a syntax (I used for each, but is of course this is not defined) to allow comprehension to result in a generator instead of a array, similar to the python one.
nums = (n * n for each n in [1, 2, 3] when n & 1)
results = (n * 2 for each n from nums)
results.next().value # 2
results.next().value # 18
results.next().done # yes