Dave Thomas wrote: > Paul Brannan <pbrannan / atdesk.com> writes: > > >> Type::const_iterator f_itor = f.begin(); >> Type::const_iterator b_itor = b.begin(); >> for(; f != f.end() && b != b.end(); ++f, ++b) >> { >> cout << "(" << *f << ", " << *b << ")" << endl; >> } >> >> However, in Ruby, aside from using weird callcc hacks, the best I can >> hope for is to use collect or to_a or something to convert the data into >> an array so that I can iterate through it. > > Have you seen knu's 'iterator.rb' module in rough/lib? > > require 'iterator.rb' > > a = [ 1, 2, 3 ] > b = %w/ant bat cat/ > c = [ /a/, /b/, /c/ ] > > IteratorGroup.new(a, b, c) do |group| > group.each {|element| puts element.inspect } > end > > #=> > > [1, "ant", /a/] > [2, "bat", /b/] > [3, "cat", /c/] That looks kind of interesting. I assume the value of this shows when the three lists have different sizes? Otherwise, it would be just as easy to iterate over the size of one list and use that as an index to pull out the corresponding element of each one. Or have I missed the point, entirely?