On Jul 4, 2006, at 11:13 PM, Sean O'Halpin wrote:

> BTW, does anyone know why zip with a block returns nil? It would be
> handy to have it map.

#zip with a block acts as an #each style iterator:

% cat zip_example.rb
a = [1, 2, 3]
b = [4, 5, 6]

a.zip(b) do |a_elem, b_elem|
   p [a_elem, b_elem]
end


% ruby zip_example.rb
[1, 4]
[2, 5]
[3, 6]

You either get the #map style functionality or the #each style  
functionality. #each is more general, e.g.:

a.to_enum(:zip, b).map { |x, y| ... }

so it makes sense to me that it's nto a map with a block.