From: Tony Arcieri Date: 2009-06-15T05:32:39+09:00 Subject: Re: each by arity --00163662e65ca06ce9046c54d7f3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Sun, Jun 14, 2009 at 1:37 PM, Joel VanderWerf wrote: > What would it do with > > [ [1,2], [3,4] ].each {|x,y| ... } > One iteration, with: x = [1,2] y = [3,4] This could be expanded out with: [ [1,2], [3,4] ].each {|(a,b),(c,d)| ... } and [ [1,2], [3,4] ].each {|(x,y)| ... } still provides the old behavior. This effectively provides the same behavior as each_slice, without the need for a separate function, and having the "n" argument of each_slice "implied" in the arity of the block. These are the cool little bits of syntactic sugar I love to see in Ruby, but I often find trying to do things with subtle little idiosyncrasies can make code confusing. each_slice is a lot clearer. -- Tony Arcieri medioh.com --00163662e65ca06ce9046c54d7f3--