"Ara.T.Howard" <ahoward / noaa.gov> schrieb im Newsbeitrag
news:Pine.LNX.4.60.0408021412540.11770 / harp.ngdc.noaa.gov...
> On Tue, 3 Aug 2004, Michael Neumann wrote:
>
> > It's the same length:
> >  a.zip(b).map {|x,y| x*y}
> >  # vs.
> >  a.combine(b) {|x,y| x*y}
>
> but one less object creation

You can save that by using inject:

a = [1,2,3]
b = [1,3,5]
a.inject([]){|arr,x| arr << (x*b[arr.size])}

Regards

    robert