6.1.3 Parallel Iteration

The loop concept of Oz also permits to iterate over several lists in parallel.

<parallel iteration>=
for 
  X in [a b c d]
  I in 1..3
do 
  {Inspect X#I}
end

This means that X and I are always set to the next possible value simultaneously. Executing the above loop thus prints:

a#1
b#2
c#3

Note that their are mixed pairs such as a#2 or b#1 of the full cross product in the output. Note also, that the iteration of the loop stops, once one of the two list over which the iteration runs becomes empty.


Denys Duchier, Claire Gardent and Joachim Niehren
Version 1.3.99 (20050412)