Issue #6727 has been updated by Eregon (Benoit Daloze).


tsion (Scott Olson) wrote: 
> 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.

An Array is not a cons list. #rest is O(n) here, compared to O(1) with cons.
So, doing ary[1..-1] or tail is something not very efficient, which you probably do not want most of the time (at least, not in a loop taking one element at a time with #first/#rest).
If it is for removing the first items, because for example, the Array is a set of lines and the first is a header, I'm fine with drop(1).

@duckinator: Could you show us a real use case for Array#rest ?
----------------------------------------
Feature #6727: Add Array#rest (with implementation)
https://bugs.ruby-lang.org/issues/6727#change-28003

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/