From: dblack@... Date: 2002-09-19T03:01:07+09:00 Subject: Re: Picking arbitrary elements from an array Hi -- On Thu, 19 Sep 2002, Hal E. Fulton wrote: > ----- Original Message ----- > From: "ts" > To: "ruby-talk ML" > Cc: > Sent: Wednesday, September 18, 2002 10:31 AM > Subject: Re: Picking arbitrary elements from an array > > > > >>>>> "M" == Michael Campbell writes: > > > > >> > Array#indices (deprecated in 1.7.*) > > > > M> Is there going to be a 1.7+ replacement? > > > > Yes, Array#select > > > > How does this relate to Enumerable#select, > which Array mixes in? Do we somehow get > the functionality of both? Judging from some 1.7.3 experimenting, it seems that Array#select, if given an argument, acts like #indices, and if given a block but no argument, acts like #find_all (for which it used to be a synonym). If given both, it raises an exception. I don't know if this is still under discussion, but in case it is... This new flavor of #select doesn't feel to me like it has the right name. Maybe I'm just used to the idea of select as involving a test, rather than an index -- and in fact it still does, some of the time. It's really the same name for two very different things. My instincts, such as they are, would lead me to lean toward a multi-arg version of #at: [1,2,3].at(1,2) => [2,3] Or is there (not for the first time) a subtlety or two I'm not getting? 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