    # File lib/facets/yore/enumerable/cross.rb, line 25
        def cross(*enums, &block)
          raise if enums.empty?
          gens = enums.map{|e| Generator.new(e)}
          return [] if gens.any? {|g| g.end?}

          sz = gens.size
          res = []
          tuple = Array.new(sz)

          loop do
            # fill tuple
            (0 ... sz).each { |i|
              tuple[i] = gens[i].current
            }
            if block.nil?
              res << tuple.dup
            else
              block.call(tuple.dup)
            end

            # step forward
            gens[-1].next
            (sz-1).downto(0) do |i|
              if gens[i].end?
                if i > 0
                  gens[i].rewind
                  gens[i-1].next
                else
                  return res
                end
              end
            end
          end #loop
        end