From: dblack@... Date: 2002-11-17T13:32:50+09:00 Subject: Re: ruby-dev summary 18613-18710 Hi -- > If you want the i-th element of each object, just iterate through the > objects and grab the i-th element :-) In fact you can save yourself a > lot of typing. Here's a rewrite: And, just for fun, here's another rewrite, this time one which isn't completely and utterly flawed (I hope): module Enumerable def zip(&block) block ||= lambda { |*tuple| tuple } top,rest = map {|e| e.size}.uniq if rest raise "zip with unequal length lists" else (0...top.to_i).map {|i| block.call(*map {|e| e[i]})} end end end David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav