Harry Ohlsen <harryo / zip.com.au> writes:

> 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.

That's one value (although of course indexing would return the same
values)

     require 'iterator.rb'

     a = [ 111, 222 ]
     b = %w/a b c/
     c = [ /a/, /b/, /c/, /d/ ]

     IteratorGroup.new(a, b, c) do |group|
       group.each {|element| puts element.inspect }
     end

  #=>

     [111, "a", /a/]                                      
     [222, "b", /b/]
     [nil, "c", /c/]
     [nil, nil, /d/]


I'm beginning to view index variables in Ruby programs as a code smell,
so I much prefer having the functionality encapsulated like this.


Dave