------ art_6670_12165929.1190088547204 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Jeff. My guess is because you need to enumerate over a Hash. Recall that entries in a Hash are indexed by some Hashing algorithm, so it's kind of had to enumerate over it's entries. It's probably cheaper to toss all the entries in a Hash into an array and iterate over it's index than to try and divine some means of iterating over the non-sequential Hash table containing index values. James On 9/17/07, Jeff <cohen.jeff / gmail.com> wrote: > > On Sep 17, 8:35 pm, franco <flazzar... / gmail.com> wrote: > > # use two vars in an map/select block (or use the index if one var) > > array :a 1, :b }.select {|k,v| k :b} > > # [[:b, 2]] > > > > # use inject to make a hash from a list, this is a great technique > > hash rray.inject({}) {|h,e| h.merge({e[0] e[1]}) } > > # {:b} > > > > -franco > > That was exactly my point - why doesn't Hash#select and Hash#map > return hashes instead of arrays? > > Jeff > > > ------ art_6670_12165929.1190088547204--