From: ES Date: 2005-10-23T02:27:30+09:00 Subject: Re: Unit testing an each function Kevin Ballard wrote: > Brian Schr�der wrote: > >>Sorry, I do not see a better syntax. But I have to admit that I have >>no idea what would be the result of >> >>[[(1..3), (5..8)], [(4..7), (2..6)]].each.each.each { |i| puts i } This is *really* hard to read if you just see: @some_array.each.each.each {|i| puts i} >>(Well if I think long enough, maybe you mean something like >> >> [[(1..3), (5..8)], [(4..7), (2..6)]].each do | row | >> row.each do | range | >> range.each do |i| puts i end >> end >> end >> >>Which I would prefer about the "new" idiom, but other people may not. > > > Yes, that is what the construct means. Each successive call is one > deeper level of enumeration. If you understand what the nested > enumeration semantics mean, then it's not hard to read. You are also happily ignoring the non-enumerable confusion that this may cause. Of course, this being a library, you are free to do as you please. E