From: dblack@... Date: 2002-09-25T00:10:56+09:00 Subject: Re: select and select Hi -- On Tue, 24 Sep 2002, Gavin Sinclair wrote: > > ----- Original Message ----- > From: > > > > 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. We've reached the "agree-to-disagree" point, but I find it interesting to talk about anyway :-) My problem with grab is that it feels like its arguments are, in grammatical terms, its direct objects ("grab these") whereas in fact what you're grabbing is what's stored at "these". So to me its "direct" quality is a little too direct. > I would prefer #values_of to #find_at, because #values is a great > choice which can't be used for technical reasons. How about #values_at ? David -- David Alan Black | Register for RubyConf 2002! home: dblack@candle.superlink.net | November 1-3 work: blackdav@shu.edu | Seattle, WA, USA Web: http://pirate.shu.edu/~blackdav | http://www.rubyconf.com