From: tho_mica_l Date: 2008-01-31T05:29:58+09:00 Subject: Re: Proposal/RFQ: Hash#values/keys with block > "Give me the keys of the hash with a value over 200." > > hash.keys {|k,v| v > 200 } Well, from my POV this is rather a special case of a more general method somewhere between inject and find_all that IMHO is missing somehow, i.e. a find_all that allow users to define the value to be stored -- so it's actually inject()? > Sure can this be solved in several other ways, but I think this would > be the most direct and intuitive way. Apart from the fact that my opinion on this doesn't matter, I'm slightly concerned with a core/stdlib coded in C growing too large/complex. > Please, everybody post your opinions. I would especially be happy if > somebody would express some support to my position... After all you only have to convince one person since there is no ruby committee I would know of. :-) > How could you return the keys without iterating over them? Uhm ... well ... BTW the code you're looking for is in hash.c: static VALUE rb_hash_keys(VALUE hash) { VALUE ary; ary = rb_ary_new(); rb_hash_foreach(hash, keys_i, ary); return ary; } Regards, Thomas.