From: Brian Candler Date: 2003-07-09T18:42:35+09:00 Subject: Re: Array.each On Wed, Jul 09, 2003 at 05:56:38PM +0900, "Pe�a, Botp" wrote: > but why not use #arity for block's param count, no? That's cool, and I hadn't thought of doing it that way. I still don't trust "yield" semantics; i.e. the implicit conversion of multiple arguments to an array or vice versa. I'd be much happier if you had to do { |*i| ... } if you wanted multiple arguments amalgamated into an array. One other point: # what follows are just testing x = '(1..8).to_a.each_group {|x,y,z| p "x = #{x}; y = #{y.inspect}; z = #{z.inspect}"}' Why did you include "to_a"? Enumerable works on iterators without having to convert them to an explicit array first. For example, you could have a file with a million lines and process it three lines at a time using File.open("/name/of/file").each_group {|l1,l2,l3| puts "<#{l1}:#{l2}>#{l3}"} If you did "to_a" it would have to read in the whole file into RAM first. Regards, Brian.