From: Dave Thomas Date: 2000-11-29T11:38:02+09:00 Subject: [ruby-talk:6612] Re: best way to interleaf arrays? David Alan Black writes: > class Array > def to_h > h = {} > each_index { |i| h[i] = at i } > h > end > end > > %w{ list of words }.to_h # => {0=>"list", 1=>"of", 2=>"words"} > > One could then invert the hash to get at least one version of the > original effect -- namely, the original array elements as hash keys > and all the values true. (Even zero!) I'm convinced by this, particular if we added the block form too. Regards Dave