From: stowers.joshua@live.com
To: ruby-core@ruby-lang.org
Subject: [ruby-core:81673] [Ruby trunk Feature#13657] Simplify usage of Enumerable#reject
Date: Wed, 14 Jun 2017 02:40:19 +0000 [thread overview]
Message-ID: <redmine.issue-13657.20170614024019.b3077f3ef6555a48@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-13657.20170614024019@ruby-lang.org
Issue #13657 has been reported by JustJosh (Joshua Stowers).
----------------------------------------
Feature #13657: Simplify usage of Enumerable#reject
https://bugs.ruby-lang.org/issues/13657
* Author: JustJosh (Joshua Stowers)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
The reject method is more complicated than it has to be when removing only a specific value.
It would be convenient if we could just plug in the value we wish to delete as an optional argument, for example:
~~~ ruby
[1, 2, 3, 4].reject(3) # => [1, 2, 4]
~~~
as apposed to:
~~~ ruby
[1, 2, 3, 4].reject { |element| element == 3 } # => [1, 2, 4]
~~~
The next best method I can think of is `#delete`, but that returns the value which is deleted.
--
https://bugs.ruby-lang.org/
next parent reply other threads:[~2017-06-14 2:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-13657.20170614024019@ruby-lang.org>
2017-06-14 2:40 ` stowers.joshua [this message]
2017-06-14 2:51 ` [ruby-core:81675] [Ruby trunk Feature#13657][Rejected] Simplify usage of Enumerable#reject shyouhei
2017-06-19 15:28 ` [ruby-core:81724] [Ruby trunk Feature#13657] " stowers.joshua
2017-06-19 22:46 ` [ruby-core:81728] " shyouhei
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.issue-13657.20170614024019.b3077f3ef6555a48@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).