* [ruby-core:103278] [Ruby master Feature#15198] Array#intersect?
[not found] <redmine.issue-15198.20181003200703.16080@ruby-lang.org>
@ 2021-04-07 19:17 ` c4am95
2021-04-08 12:32 ` [ruby-core:103301] " marcandre-ruby-core
` (2 subsequent siblings)
3 siblings, 0 replies; 4+ messages in thread
From: c4am95 @ 2021-04-07 19:17 UTC (permalink / raw)
To: ruby-core
Issue #15198 has been updated by c4am95 (Travis Hunter).
Matz/Marc-Andre: anything I can do to help here as far as documentation or providing more use cases? I/my colleagues would love to see this make it into Ruby.
----------------------------------------
Feature #15198: Array#intersect?
https://bugs.ruby-lang.org/issues/15198#change-91364
* Author: c4am95 (Travis Hunter)
* Status: Open
* Priority: Normal
----------------------------------------
I frequently find myself needing to determine if two arrays intersect but not actually caring about the intersection, so I write code like:
~~~ ruby
(a1 & a2).any?
~~~
It would be nice to have an **intersect?** convenience method on **Array** to perform this query.
[ruby#1972: Add Array#intersect?](https://github.com/ruby/ruby/pull/1972)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:103301] [Ruby master Feature#15198] Array#intersect?
[not found] <redmine.issue-15198.20181003200703.16080@ruby-lang.org>
2021-04-07 19:17 ` [ruby-core:103278] [Ruby master Feature#15198] Array#intersect? c4am95
@ 2021-04-08 12:32 ` marcandre-ruby-core
2021-04-16 6:56 ` [ruby-core:103474] " matz
2021-04-16 7:03 ` [ruby-core:103475] " knu
3 siblings, 0 replies; 4+ messages in thread
From: marcandre-ruby-core @ 2021-04-08 12:32 UTC (permalink / raw)
To: ruby-core
Issue #15198 has been updated by marcandre (Marc-Andre Lafortune).
Assignee set to matz (Yukihiro Matsumoto)
I am positive on the feature as has valid use cases, it can be optimized in C and as a bonus adds no cognitive load.
I believe we just need a final "yay" from Matz. I'll add it to the next meeting's agenda.
----------------------------------------
Feature #15198: Array#intersect?
https://bugs.ruby-lang.org/issues/15198#change-91386
* Author: c4am95 (Travis Hunter)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
I frequently find myself needing to determine if two arrays intersect but not actually caring about the intersection, so I write code like:
~~~ ruby
(a1 & a2).any?
~~~
It would be nice to have an **intersect?** convenience method on **Array** to perform this query.
[ruby#1972: Add Array#intersect?](https://github.com/ruby/ruby/pull/1972)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:103474] [Ruby master Feature#15198] Array#intersect?
[not found] <redmine.issue-15198.20181003200703.16080@ruby-lang.org>
2021-04-07 19:17 ` [ruby-core:103278] [Ruby master Feature#15198] Array#intersect? c4am95
2021-04-08 12:32 ` [ruby-core:103301] " marcandre-ruby-core
@ 2021-04-16 6:56 ` matz
2021-04-16 7:03 ` [ruby-core:103475] " knu
3 siblings, 0 replies; 4+ messages in thread
From: matz @ 2021-04-16 6:56 UTC (permalink / raw)
To: ruby-core
Issue #15198 has been updated by matz (Yukihiro Matsumoto).
Accepted.
Matz.
----------------------------------------
Feature #15198: Array#intersect?
https://bugs.ruby-lang.org/issues/15198#change-91572
* Author: c4am95 (Travis Hunter)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
I frequently find myself needing to determine if two arrays intersect but not actually caring about the intersection, so I write code like:
~~~ ruby
(a1 & a2).any?
~~~
It would be nice to have an **intersect?** convenience method on **Array** to perform this query.
[ruby#1972: Add Array#intersect?](https://github.com/ruby/ruby/pull/1972)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:103475] [Ruby master Feature#15198] Array#intersect?
[not found] <redmine.issue-15198.20181003200703.16080@ruby-lang.org>
` (2 preceding siblings ...)
2021-04-16 6:56 ` [ruby-core:103474] " matz
@ 2021-04-16 7:03 ` knu
3 siblings, 0 replies; 4+ messages in thread
From: knu @ 2021-04-16 7:03 UTC (permalink / raw)
To: ruby-core
Issue #15198 has been updated by knu (Akinori MUSHA).
We discussed this in today's developer meeting. Here are some remarks:
- It takes one argument for now.
- It means !(a & b).empty? instead of (a & b).any? so [nil].intersect?([nil]) evaluates to true.
- The implementation will internally use a hash to match the behavior of Array#&.
----------------------------------------
Feature #15198: Array#intersect?
https://bugs.ruby-lang.org/issues/15198#change-91573
* Author: c4am95 (Travis Hunter)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
I frequently find myself needing to determine if two arrays intersect but not actually caring about the intersection, so I write code like:
~~~ ruby
(a1 & a2).any?
~~~
It would be nice to have an **intersect?** convenience method on **Array** to perform this query.
[ruby#1972: Add Array#intersect?](https://github.com/ruby/ruby/pull/1972)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-04-16 7:03 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-15198.20181003200703.16080@ruby-lang.org>
2021-04-07 19:17 ` [ruby-core:103278] [Ruby master Feature#15198] Array#intersect? c4am95
2021-04-08 12:32 ` [ruby-core:103301] " marcandre-ruby-core
2021-04-16 6:56 ` [ruby-core:103474] " matz
2021-04-16 7:03 ` [ruby-core:103475] " knu
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).