From: Yossef Mendelssohn Date: 2009-06-15T05:43:20+09:00 Subject: Re: each by arity On Jun 14, 3:32 pm, Tony Arcieri wrote: > 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. And by "the old behavior" I presume you mean two iterations: x = 1 y = 2 x = 3 y = 4 And how is that going to happen based on inspecting arity? At least with 1.8.6, Proc.new {|x, y| } and Proc.new {|(x, y)| } both have an arity of 2. > each_slice is a lot clearer. Yes. Yes, it is. -- -yossef