Hello --

Is there a nice Ruby idiom for interleafing arrays?  It's not hard to
write a method that will do it, but I'd be interested in knowing how
it's been done in the past.

By the way, my curiosity about this stems from some tinkering with
hashes -- specifically, trying to populate a hash from two arrays.  A
related problem, which I'll throw in here too, is how best to create a
hash which simply sets each value to "true" (or 1, or whatever).  The
best I've come up with for that is:

   h = Hash[*arr.map { |x| [x,true] } .flatten ]

which feels awfully roundabout for this purpose.  Intervention
is welcome.

Thanks --


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav