> http://redmine.ruby-lang.org/issues/4539
>
> Author: Michael Kohl
>
> Inspired by Haskell's ((|zipWith|)) function, I hacked on together for Ru=
by:
>
> =A0[1,2,3].zip_with([6,5,4], :+) #=3D> [7, 7, 7]
> =A0[1,2,3].zip_with([6,5,4]) { |a,b| 3*a+2*b } #=3D> [15, 16, 17]
>
> So far I only have a Ruby version of it:
>
> https://gist.github.com/731702b90757e21cadcb
>
> My questions:
>
> 1. Would this method be considered a worthwhile addition to Array?
>
> 2. I've never hacked on the C side of Ruby (read some parts of the source=
 though) and my C is quite rusty. I'd like to change that, would somebody b=
e willing to help me turn this into a proper patch?

Hello,

I'm answering here since redmine won't answer to my requests (even got a 50=
0).

I think this new method would be redundant with Array#zip.
But I agree doing c.zip(d).map { |a,b| a+b } is a bit long.

So I propose to change the return value of Array#zip (and
Enumerable#zip) with a block from nil to the result #map would give
(so an Array of all yielded elements).

An unconditional nil is anyway not useful here, the only concern I see
might be the cost of creating this Array.
But I think many cases with block simulate #map and it would avoid
creating the intermediate Array in a.zip(b).map {}.

This would not address the case with a Symbol, which could be easily
detected as last argument as it is not Enumerable.
But blocks simplified by Symbol have rarely been accepted and I think
only changing the return value would already improve #zip a lot.

Here is a gist with a Ruby implementation of the modifications for
Array#zip: https://gist.github.com/903388
I'm wishing to do a C implementation if this feels right for others,
but I'd like to have opinions first.

What do you think?