From: raja@... (Raja S.) Date: 2000-12-09T18:10:03+09:00 Subject: [ruby-talk:6956] 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. One could get part of the behavior i'm after with for i in 0...a1.length x,y,z = a1[i], a2[i], a1[i], but was wondering if there was something along the lines of Common Lisp's 'loop' where x & y move in tandem: (loop for x in '(1 3 5 7 9) for y in '(1 9 25 49 81) do (format t "~& ~d ~d" x y)) Python has come recently added the 'zip' facility. Reasonable, but it also creates unnecessary garbage by creating an object that in most situations gets discarded once one is out of the loop. Raja