From: Mathieu Bouchard Date: 2000-12-10T13:33:36+09:00 Subject: [ruby-talk:6996] Re: parallel array traversal > Is there a way to do a parallel traversal of a group of arrays in Ruby? > Or more generally move a collection of index variables in lock-step? > Currently, in Ruby: > for (x,y,z) in [a1, a2,a3] > has a different and vary valid semantics. code below: class Array def each2(&p) collect {|a| a.length }.min.times {|i| yield collect {|a|a[i]} } end end note that turning the above into Common Lisp's "map" function should be fairly easy. (about 8 more chars.) matju