From: David Alan Black Date: 2001-02-16T01:55:01+09:00 Subject: [ruby-talk:10911] Re: RubyChangeRequest #U002: new proper name for Hash#indexes, Array#indexes On Fri, 16 Feb 2001, Mathieu Bouchard wrote: > On Thu, 15 Feb 2001, David Alan Black wrote: > > Having the single index return a single value, and multiple ones return > > an array, is in keeping with the behavior of #[], so in that sense it > > would be consistent. > > 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 -- ? > Currently I still prefer #values_at(*indices) though... So do I, actually :-) David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav