From: Charles Mills Date: 2004-08-03T10:51:34+09:00 Subject: Re: Request for two methods in Array class On Aug 2, 2004, at 1:21 PM, Ara.T.Howard wrote: > 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 > >> But I must say, that I like the name combine a lot. > > ditto. Seems like a good idea. After reading the chapter of Meyers book Lothar sent, the idea seems even better. Another name idea is collect_wtih c = a.collect_with(b) { |x,y| x*y } a.collect_with!(b) { |x,y| x*y } # looks bad? d = a.collect_with(b, c) { |x,y,z| x*y*z } # multiple params would be useful -Charlie > > -a > -- > ======================================================================= > ======== > | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov > | PHONE :: 303.497.6469 > | A flower falls, even though we love it; > | and a weed grows, even though we do not love it. | --Dogen > ======================================================================= > ======== >