A
Andrew Wagner
[Note: parts of this message were removed to make it a legal post.]
How can I get a lazy array in Ruby? E.g., in Haskell, I can talk about
[1..], which is an infinite list, lazily generated as needed. I can also do
things like "iterate (+2) 0", which applies whatever function I give it to
generate a lazy list. In this case, it would give me all even numbers.
Anyway, I'm sure I can do such things in Ruby, but can't seem to work out
how.
How can I get a lazy array in Ruby? E.g., in Haskell, I can talk about
[1..], which is an infinite list, lazily generated as needed. I can also do
things like "iterate (+2) 0", which applies whatever function I give it to
generate a lazy list. In this case, it would give me all even numbers.
Anyway, I'm sure I can do such things in Ruby, but can't seem to work out
how.