On Tue, 3 Aug 2004 18:32:31 +0900, Michael Neumann <mneumann / ntecs.de> wrote:
> Yukihiro Matsumoto 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.
> 
> combine sounds nice to me. it "combinates" two or more arrays (or
> enumerables) into one. but one might argue against combine as name, as
> it it's not clear that combine returns an array that is not larger than
> it's arguments joined together.
> 
> IMO, combine should be equal to zip.map:
> 
>    enum.combine(enum2, enum3,...) { block }
>    # equal
>    enum.zip(enum2, enum3,...).map { block }
> 
> >   * whether it takes only one argument or any number of arguments.
> 
> many
> 
> >   * whether "multiplication" should be the default.
> 
> no. default should be "{|arr| arr}" (the default of map)
> 
> Regards,
> 
>    Michael
> 
> 

How about (snipped from Sean's e-mail earlier)

a.weave(b)
#=> [[1, 1], [2, 3], [3, 5]]

The default action would be to create the larger array, but a block
could be used to prevent the array from growing, aka

a.weave(b) {|x,y| x*y} 
#=> [1, 6, 15]