----- Original Message ----- From: <dblack / candle.superlink.net> > Hi -- > > On Tue, 24 Sep 2002, Gavin Sinclair wrote: > > > Hashes and arrays map keys to values. The method we are looking for > > returns several values based on several keys. > > I think I mentioned the following idea before, but I don't remember > any response to it (and I'm kind of warming to it :-). > > Namely: Enumerable#find_at > > It has the following going for it, in my opinion: > > 1. it has "at" in it (see my last post for why I like "at" more than > verbs) > > 2. it makes a nice set with #find and #find_all: > > a = %w{one two three four} > a.find {|e| e[0] == ?t} # "two" > a.find_all {|e| e.size > 3} # ["three", "four"] > a.find_at(0,2) # ["one", "three"] > > 3. it doesn't already exist :-) > > > David > Your reasons are good, but I don't like it :-> Reason: given an index into a data structure, you don't "find" something, you get it directly. That's what indices are all about. That's why I like "grab": it connotes directness. I would prefer #values_of to #find_at, because #values is a great choice which can't be used for technical reasons. Gavin