From: Glenn Parker Date: 2004-12-09T03:29:30+09:00 Subject: Re: Idiom for creating hash from two arrays David A. Black wrote: > On Thu, 9 Dec 2004, Glenn Parker wrote: >> This style of expression can only create a new hash instead of >> updating an existing hash. I think the "core" operation is >> updating/merging an existing hash with a set of matched keys and values. > > hash.update(key_array.hash_with(value_array)) :-) Unless Ruby is much smarter than I thought, this will build a new (albeit temporary) hash, then pass it to Hash#update. Not quite the same as updating hash in place, and less efficient in terms of memory usage. The smiley suggests to me you already appreciate this distinction. :) -- Glenn Parker | glenn.parker-AT-comcast.net |