From: Olivier Nenert Date: 2003-08-30T00:26:17+09:00 Subject: Re: multiply all array with array > thx all ya guys, > >>> 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} > > this is indeed much more elegant. > > but because array * array is not defined, me thinks. one could implement > (this simple case) this way. but I think most people (or at least I) would expect a cartesian product as the result of this operator.. it would be much more useful because it would work with any two arrays, not just two arrays with the same size. (oh well it could also work like you say with arrays of different sizes if we fill with zeros the shorter one :)) cheers.. Olivier.