From: "duckinator (Nick Markwell)" <nick@duckinator.net>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:46381] [ruby-trunk - Feature #6727] Add Array#rest (with implementation)
Date: Fri, 13 Jul 2012 14:33:21 +0900 [thread overview]
Message-ID: <redmine.journal-27997.20120713143319@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-6727.20120713132504@ruby-lang.org
Issue #6727 has been updated by duckinator (Nick Markwell).
And I just double-checked if those behave the same, and they do *not*:
Incorrect:
>> [].drop(1)
=> []
>> first, *rest = []
=> []
>> first
=> nil
>> rest
=> nil
Correct:
>> [][1..-1]
=> nil
>> [].rest
=> nil
So it would appear there are not other choices besides rest = arr[1..-1], at least not that fit on a single line.
----------------------------------------
Feature #6727: Add Array#rest (with implementation)
https://bugs.ruby-lang.org/issues/6727#change-27997
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/
next prev parent reply other threads:[~2012-07-13 5:36 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-13 4:25 [ruby-core:46377] [ruby-trunk - Feature #6727][Open] Add Array#rest (with implementation) duckinator (Nick Markwell)
2012-07-13 4:55 ` [ruby-core:46378] [ruby-trunk - Feature #6727][Rejected] " marcandre (Marc-Andre Lafortune)
2012-07-13 5:22 ` [ruby-core:46380] [ruby-trunk - Feature #6727] " duckinator (Nick Markwell)
2012-07-13 5:33 ` duckinator (Nick Markwell) [this message]
2012-07-13 5:46 ` [ruby-core:46382] " programble (Curtis McEnroe)
2012-07-13 6:01 ` [ruby-core:46384] " tsion (Scott Olson)
2012-07-13 11:30 ` [ruby-core:46388] " Eregon (Benoit Daloze)
2012-07-13 13:44 ` [ruby-core:46391] [ruby-trunk - Feature #6727][Assigned] " naruse (Yui NARUSE)
2012-07-13 14:31 ` [ruby-core:46392] [ruby-trunk - Feature #6727] " marcandre (Marc-Andre Lafortune)
2012-07-13 15:00 ` [ruby-core:46395] " trans (Thomas Sawyer)
2012-07-13 15:34 ` [ruby-core:46396] " duckinator (Nick Markwell)
2012-10-27 15:14 ` [ruby-core:48487] " yhara (Yutaka HARA)
2012-10-28 2:25 ` [ruby-core:48511] " duckinator (Nick Markwell)
2012-10-28 11:25 ` [ruby-core:48515] " Eregon (Benoit Daloze)
2013-11-09 20:12 ` [ruby-core:58239] " baweaver (Brandon Weaver)
2013-11-09 20:38 ` [ruby-core:58240] " Fuad Saud
2013-11-10 15:27 ` [ruby-core:58249] " marcandre (Marc-Andre Lafortune)
2013-11-11 7:19 ` [ruby-core:58267] " "Martin J. Dürst"
2013-11-10 16:47 ` [ruby-core:58256] " Hanmac (Hans Mackowiak)
2013-11-11 7:21 ` [ruby-core:58268] " "Martin J. Dürst"
2013-11-11 9:18 ` [ruby-core:58273] " alexeymuranov (Alexey Muranov)
2013-11-11 9:27 ` [ruby-core:58274] " Hanmac (Hans Mackowiak)
2013-11-11 17:29 ` [ruby-core:58283] " fuadksd (Fuad Saud)
2013-11-12 1:04 ` [ruby-core:58285] " "Martin J. Dürst"
2019-08-14 8:51 ` [ruby-core:94346] [Ruby master Feature#6727] " mame
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-27997.20120713143319@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).