From: dblack@... Date: 2002-11-19T09:06:05+09:00 Subject: Re: ruby-dev summary 18711-18810 Hi -- On Tue, 19 Nov 2002, Massimiliano Mirra wrote: > On Tue, Nov 19, 2002 at 12:19:50AM +0900, dblack@candle.superlink.net wrote: > > > |Do you mean that map_with_index has been rejected on its own, or just > > > |as a zip implementation? > > Hmmmm.... I'll try to think of some examples. It certainly seems to > > me to be at least as useful as each_with_index, potentially (i.e., if > > it existed :-) > > I guess, if zip existed, you could simulate that with: > > a = ["a", "b", "c", "d"] > a.zip(0...a.length).map {|item, index| ...} And if map_with_index existed, you could define #zip in terms of it :-) def zip(*others) map_with_index {|e,i| [e,others.map{|n| n[i]}]} end (or something) David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav