ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:81673] [Ruby trunk Feature#13657] Simplify usage of Enumerable#reject
       [not found] <redmine.issue-13657.20170614024019@ruby-lang.org>
@ 2017-06-14  2:40 ` stowers.joshua
  2017-06-14  2:51 ` [ruby-core:81675] [Ruby trunk Feature#13657][Rejected] " shyouhei
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: stowers.joshua @ 2017-06-14  2:40 UTC (permalink / raw)
  To: ruby-core

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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:81675] [Ruby trunk Feature#13657][Rejected] Simplify usage of Enumerable#reject
       [not found] <redmine.issue-13657.20170614024019@ruby-lang.org>
  2017-06-14  2:40 ` [ruby-core:81673] [Ruby trunk Feature#13657] Simplify usage of Enumerable#reject stowers.joshua
@ 2017-06-14  2:51 ` shyouhei
  2017-06-19 15:28 ` [ruby-core:81724] [Ruby trunk Feature#13657] " stowers.joshua
  2017-06-19 22:46 ` [ruby-core:81728] " shyouhei
  3 siblings, 0 replies; 4+ messages in thread
From: shyouhei @ 2017-06-14  2:51 UTC (permalink / raw)
  To: ruby-core

Issue #13657 has been updated by shyouhei (Shyouhei Urabe).

Status changed from Open to Rejected

That's grep_v.

```ruby
[1, 2, 3, 4].grep_v(3) # => [1, 2, 4]
```

----------------------------------------
Feature #13657: Simplify usage of Enumerable#reject
https://bugs.ruby-lang.org/issues/13657#change-65364

* Author: JustJosh (Joshua Stowers)
* Status: Rejected
* 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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:81724] [Ruby trunk Feature#13657] Simplify usage of Enumerable#reject
       [not found] <redmine.issue-13657.20170614024019@ruby-lang.org>
  2017-06-14  2:40 ` [ruby-core:81673] [Ruby trunk Feature#13657] Simplify usage of Enumerable#reject stowers.joshua
  2017-06-14  2:51 ` [ruby-core:81675] [Ruby trunk Feature#13657][Rejected] " shyouhei
@ 2017-06-19 15:28 ` stowers.joshua
  2017-06-19 22:46 ` [ruby-core:81728] " shyouhei
  3 siblings, 0 replies; 4+ messages in thread
From: stowers.joshua @ 2017-06-19 15:28 UTC (permalink / raw)
  To: ruby-core

Issue #13657 has been updated by JustJosh (Joshua Stowers).


Great! You're right, that will accomplish this _exactly_.

Do you see any hope in adding this functionality to `#reject` regardless of the existence of `#grep_v`?
This other method is difficult to make sense of unless the developers are either familiar with it already or have used `grep` extensively enough to recognize its purpose.

Adding the functionality would also reduce the number of methods developer's have to know.
Also it wouldn't hurt to have.

Thanks for pointing out the existence of `#grep_v`

----------------------------------------
Feature #13657: Simplify usage of Enumerable#reject
https://bugs.ruby-lang.org/issues/13657#change-65425

* Author: JustJosh (Joshua Stowers)
* Status: Rejected
* 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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:81728] [Ruby trunk Feature#13657] Simplify usage of Enumerable#reject
       [not found] <redmine.issue-13657.20170614024019@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2017-06-19 15:28 ` [ruby-core:81724] [Ruby trunk Feature#13657] " stowers.joshua
@ 2017-06-19 22:46 ` shyouhei
  3 siblings, 0 replies; 4+ messages in thread
From: shyouhei @ 2017-06-19 22:46 UTC (permalink / raw)
  To: ruby-core

Issue #13657 has been updated by shyouhei (Shyouhei Urabe).


I guess this request is a variant of https://bugs.ruby-lang.org/issues/11286 (if not identical). You would like to join the thread which is still open, i.e there are chances to introduce your request.

----------------------------------------
Feature #13657: Simplify usage of Enumerable#reject
https://bugs.ruby-lang.org/issues/13657#change-65428

* Author: JustJosh (Joshua Stowers)
* Status: Rejected
* 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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-19 22:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-13657.20170614024019@ruby-lang.org>
2017-06-14  2:40 ` [ruby-core:81673] [Ruby trunk Feature#13657] Simplify usage of Enumerable#reject stowers.joshua
2017-06-14  2:51 ` [ruby-core:81675] [Ruby trunk Feature#13657][Rejected] " shyouhei
2017-06-19 15:28 ` [ruby-core:81724] [Ruby trunk Feature#13657] " stowers.joshua
2017-06-19 22:46 ` [ruby-core:81728] " shyouhei

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).