What would seem most natural (and best) would be:

a[1,3,5,6,7] or more generally a[list] (a[*list] seems unnecessarily complex and would be inconsistent with a[x..y] that is allowed).

Is there a good reason this shouldn't be allowed? It would certainly simplify and shorten much of my code.

-j

Rick DeNatale wrote:
> On 9/13/06, gwtmp01 / mac.com <gwtmp01 / mac.com> wrote:
> 
>> Another nice thing about values_at is that it understands ranges:
>>
>> a = Array.new(10) { |x| x*2 }   #=> [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
>>
>> b = a.values_at(1,3,5..7)       #=> [2, 6, 10, 12, 14]
> 
> But not an array?!
> 
> irb(main):005:0> (0..10).to_a.values_at([2, 3, 4, 5])
> TypeError: can't convert Array into Integer
>        from (irb):5:in `values_at'
>        from (irb):5
>        from :0
> 
> This seems a little inconsistent, it would seem better if it handled
> any arguments which were enumerables containing integers.
>