From: "yhara (Yutaka HARA)" <redmine@ruby-lang.org>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:48242] [ruby-trunk - Feature #6240] Enumerable#drop with negative argument
Date: Thu, 25 Oct 2012 17:48:28 +0900 [thread overview]
Message-ID: <redmine.journal-31517.20121025174826@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-6240.20120401055741@ruby-lang.org
Issue #6240 has been updated by yhara (Yutaka HARA).
Target version changed from 2.0.0 to next minor
----------------------------------------
Feature #6240: Enumerable#drop with negative argument
https://bugs.ruby-lang.org/issues/6240#change-31517
Author: marcandre (Marc-Andre Lafortune)
Status: Assigned
Priority: Normal
Assignee: matz (Yukihiro Matsumoto)
Category: core
Target version: next minor
Currently, Enumerable#drop works only for non-negative arguments.
It could be extended so that negative arguments means dropping from the end:
[:hello, :world].drop(-1) # => [:hello]
This could especially be interesting for `Lazy#drop`, which would keep a circular buffer of elements before yielding them.
(1..6).lazy.drop(-3).each{|x| puts x} # -> prints 1, 2 and 3
Thoughts?
--
http://bugs.ruby-lang.org/
next prev parent reply other threads:[~2012-10-25 8:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-31 20:57 [ruby-core:44028] [ruby-trunk - Feature #6240][Open] Enumerable#drop with negative argument marcandre (Marc-Andre Lafortune)
2012-04-01 0:05 ` [ruby-core:44030] [ruby-trunk - Feature #6240] " shugo (Shugo Maeda)
2012-04-01 23:38 ` [ruby-core:44047] " marcandre (Marc-Andre Lafortune)
2012-04-02 1:41 ` [ruby-core:44051] " shugo (Shugo Maeda)
2012-04-02 13:59 ` [ruby-core:44069] [ruby-trunk - Feature #6240][Assigned] " mame (Yusuke Endoh)
2012-10-25 8:48 ` yhara (Yutaka HARA) [this message]
2019-01-10 8:30 ` [ruby-core:90982] [Ruby trunk Feature#6240] " knu
2019-01-10 23:07 ` [ruby-core:91006] [Ruby trunk Feature#6240][Closed] " ruby-core
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-31517.20121025174826@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).