Hello -- On Fri, 16 Feb 2001, Kenichi Komiya wrote: > Hi, > > In [ruby-list:27832], I posted a code snipet that let you create > a Hash from lists of keys and values. > > hash = Hash.map(%w(Matz Larry), %(Ruby, Perl)) > > p hash # => {"Larry"=>"Perl", "Matz"=>"Ruby"} > > The signature of this method looks like: > > Hash.map(keys, vals, def_val=nil) There were a couple of flurries of discussion about a possible Hash#from_array and/or Array#to_hash method on this list a few months ago. See the thread "best way to interleaf arrays?", ([ruby-talk:6582] and thereafter, especially around the 6610's). I'm afraid I'm the one responsible for misspelling "interleave" :-) > Q1: Do you think this is worth including to core Ruby? Yes. I tend to think in terms of Array#to_hash more than Hash#from_array, but perhaps both (?). > Q2: Do you think the name is confusing? If so what is good > name for this method? See names above, which I think would be OK. > Q3: I belive there was a discussion to create a snipet > repository, which archives useful but small code examples. > Is this facility already online? I can only answer from one perspective, namely that of the Ruby Garden, which is intended to be more of a workshop than a repository, though possibly that too. The answer is that it isn't online yet. However, I defer to others who may have repositories of various kinds up and running. David -- David Alan Black home: dblack / candle.superlink.net work: blackdav / shu.edu Web: http://pirate.shu.edu/~blackdav