Yukihiro Matsumoto wrote:
> 
> Hi,
> 
> In message "[ruby-talk:10853] Re: RubyChangeRequest #U002: new proper name for Hash#indexes, Array#indexes"
>     on 01/02/15, "Mike Wilson" <wmwilson01 / hotmail.com> writes:
> 
> |Array#at seems to be most similar, only it just takes 1 argument.  Would it
> |be possible to extend that to multiple arguments and for the Hash as well?
> 
> Possible.  The key is here.
> 
> |a.at(0)   -> 1 # maybe change to [1]?
> 
> For consistency, at(0) might be better to return an array, but it's
> incompatibility, which I don't want to incorporate.
> 
> Array#elements? Hash#values?
> 

How do the following three or four choices seem to others?

In considering these options and how they might look, I refer
to my_array and my_hash:

my_array = ["fred", "joe", "jane"]
my_hash = {"first"=>"fred","second"=>"joe","third"=>"jane"}


1. #subset
I think that since we can select them and form a new array of values,
using Array#subset and Hash#subset might be relevant. 

my_array.subset(1,2) => ["joe","jane"]
my_hash.subset("second","third") => ["joe","jane"]


2. #selections
Yet another could be Array#selections and Hash#selections:

my_array.selections(1,2) => ["joe","jane"]
my_hash.selections("second","third") => ["joe","jane"]


3. #collect_indexes / #select_indexes
Also to be noted is Array#collect_indexes, (pretend that this is the 
long form for Array#indexes ;-). Afterall, #collect already
exists and does create an array (but not available for hashes). 
Also, #collect_from_indexes could be used, but that is long.

my_array.collect_indexes(1,2) => ["joe","jane"]
my_hash.collect_indexes("second","third") => ["joe","jane"]


Parallel to that is #select_indexes. We do have #select from the
Enumerable module, so this may be more recognizable. 

my_array.select_indexes(1,2) => ["joe","jane"]
my_hash.select_indexes("second","third") => ["joe","jane"]

Both #collect and #select normally take a block, but #collect_indexes
or #select_indexes would not.



Guy N. Hurst

-- 
HurstLinks Web Development    http://www.hurstlinks.com/
Norfolk, VA  23510            (757)623-9688 FAX 623-0433
PHP/MySQL - Ruby/Perl - HTML/Javascript