Yukihiro Matsumoto <matz / ruby-lang.org> wrote:
> Hi,
> 
> In message "Request for two methods in Array class"
>     on 04/08/03, Mike Hall <mghallNO / SPAMenteract.com> writes:
> 
> |1. A new method, Array.combine  (needs a better name for general use).
> |   It takes entries from two (or many) arrays and combines them.
> |   (like a combination of Array.zip, fetch, and map)
> 
> Sounds nice.  But I'm not sure "combine" is a proper name for the
> method.   We need more discussion, for example:
> 
>   * the best name for the behavior.
>   * whether it takes only one argument or any number of arguments.

Any number, I'd say

>   * whether "multiplication" should be the default.

Almost certainly not.

Getting a bit complicated, but what I'd like is to check if the last or
two last args are a symbol and an optional seed, which are injected
across the current tuple.

e.g. the multiplication case would be a.combine(b,c,d, :*) which would mean
a.zip(b,c,d) {|*args| args.inject {|a,v| a.send(:*, v)}}

If both a symbol and a block are provided, the symbol is injected first
and the result passed to the block.

Default (no symbol and no block) should be to just zip the arrays.

martin