On Jun 26, 2006, at 4:48 PM, Christian Neukirchen wrote:

> It actually takes a block, but only yields and doesn't map.  It would
> take a lot of memory if it had to map in every case---not sure that is
> a good reason, though.


Yet another great use of enumerator

[1,2,3].to_enum(:zip, [4, 5, 6]).map { |x, y| x + y }

Sure, it's a _little_ verbose, but it works.

One could even do

class Array
   def zip_with(array, &block)
     to_enum(:zip, array).map(&block)
   end
end

if the above is too much typing.