From: "Wesley J. Landaker" Date: 2003-08-29T22:57:36+09:00 Subject: Re: multiply all array with array Apparently, Martin DeMello recently wrote: > ibotty wrote: >> before i spent to many words describing something so simple: >> >> say, i have: >> a = [1,2,3] and b = [4,5,6] >> and i want to get another array, with c[ix] = a[ix] * b[ix]. >> (i want to get c = [4,10,18]) >> >> is there a builtin function in array.rb (that i have missed). > > Not quite, but for parallel traversing made easier > > a.zip(b).map {|i, j| i*j} > Hey, this is just like what I just posted, except better! =) (That's what I get for replying before reading the rest of the thread... ;) Wes