dblack@superlink.net wrote:
But the special case of converting an associative array to a hash is
different from the “classic” (in terms of volume of ruby-talk devoted
to it, and how long we’ve been discussing itarray-to-hash
conversion, as per RCR #12 and its definition of “hashify” (a term I
proposed reluctantly, knowing people would hate itbut it seemed
the most accurate for what I was describing). Modularization is a
good idea, though, particularly for the various home-grown
[{to_(h}ash]ify) variants in circulation, though organizing that kind
of thing community-wide is something I’ve never figured out how to do.
To me, ‘hashify’ implies taking an assoc array and converting it to hash
form (or perhaps the perl-influenced [a, b, c, d] → {a=>b, c=>d}). I
still can’t think of a name for the useful case make_hash, perhaps …
*(1…10).make_hash {|i| f(i)}
or maybe the complementary hash_to and hash_from, where the block is
respectively the value and the key for the corresponding array entry
martin