I think I would write the fibs expression as<p><pre><code> fibs = [true,false].lazy.flat_map{|i| if i then [1,1] else fibs.zip(fibs.drop(1)).map{|a,b| a+b} end}
</code></pre>
instead of the author's<p><pre><code> fibs = inf.map do |n|
if n < 3
1
else
fibs.zip(fibs.drop(1)).map { |a, b| a + b }.first(n - 2).last
end
end
</code></pre>
because I think my way looks a lot closer to the Haskell version. It still has the problem that Enumerator::Lazy doesn't memoize, so finding the nth element of fibs (in either of these two Ruby versions) does an exponential (Fibonacci, in fact) number of additions, unlike the Haskell version that does n-1 additions.