From: Mathieu Bouchard Date: 2001-02-17T03:26:20+09:00 Subject: [ruby-talk:10989] Re: RubyChangeRequest #U002: new proper name for Hash#indexes, Array#indexes On Fri, 16 Feb 2001, David Alan Black wrote: > On Fri, 16 Feb 2001, Mathieu Bouchard wrote: > > Sorry, not really... > > a = [2,3,5,7] > > a[2] #=> 5, one element in single mode > > a[2..2] #=> [5], one element in multiple mode > irb(main):001:0> a = [1,2,3,4] > [1, 2, 3, 4] > irb(main):002:0> a[1].type > Fixnum > irb(main):003:0> a[1..1].type > Array > I thought the proposed extension to #at would behave like that too -- ? What do you mean, would behave like that? The proposed extension would make #at(*indices) return an array, but #at cannot distinguish a list of one element from a single value -- it's still a parameter list. There is no equivalent in the #[] realm, which can distinguish a one-element range from a single element fetch anytime. matju