Issue #6727 has been updated by tsion (Scott Olson).


I agree, I see and use ary[1..-1] quite a lot, and ary.rest would convey the meaning a lot better.

And it isn't just the ugliness of the syntax of ary[1..-1] that makes it undesirable, there's also the fact that it is zero-based from the front end and one-based from the back end (I know this can't really be helped because 0 == -0, but it does make Array#rest more desirable).

On top of that, I think #first and #rest make a nice pair, like head and tail from Haskell or any language with cons lists.
----------------------------------------
Feature #6727: Add Array#rest (with implementation)
https://bugs.ruby-lang.org/issues/6727#change-28000

Author: duckinator (Nick Markwell)
Status: Rejected
Priority: Normal
Assignee: 
Category: 
Target version: 


=begin
I run into many instances where I end up using (({arr[1..-1]})), so I decided to add (({arr.rest})) to make that a bit less hideous.

Branch on github: ((<URL:https://github.com/duckinator/ruby/compare/feature/array_rest>))

Patch: ((<URL:https://github.com/duckinator/ruby/compare/feature/array_rest.patch>))

Diff: ((<URL:https://github.com/duckinator/ruby/compare/feature/array_rest.diff>))
=end


-- 
http://bugs.ruby-lang.org/