On Tue, 11 Sep 2001 00:23:24 GMT, ptkwt / shell1.aracnet.com (Phil Tomson)
wrote:

>Admittedly, for this particular type of thing, perl does a lot of work for 
>you.
>
>This is the Ruby solution I came up with - anybody got anything shorter?

#How about a more general solution:

class Array
  def each_tuple
    n = map { |a| a.length } . max
    n.times { |i| yield( map { |e| e[i] } ) }
  end
end

class Hash
  def Hash.fromTuple(*a)
    b = a.map { |e| e.kind_of?(Array) ? e : e.to_a }
    h = Hash.new
    b.each_tuple { |t| h[t[0]] = t[1] }
    return h
  end
end

aHash = Hash.fromTuple( 'A'..'Z', 0..25 )