From: marcandre-ruby-core@... Date: 2021-04-28T04:49:30+00:00 Subject: [ruby-core:103635] [Ruby master Bug#17838] `Set#intersect?` and enumerables Issue #17838 has been reported by marcandre (Marc-Andre Lafortune). ---------------------------------------- Bug #17838: `Set#intersect?` and enumerables https://bugs.ruby-lang.org/issues/17838 * Author: marcandre (Marc-Andre Lafortune) * Status: Open * Priority: Normal * Assignee: knu (Akinori MUSHA) * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- `Set#intersect?` currently accepts only a `set` argument. It should accept an enumerable argument: ```ruby [1, 2, 3].intersect?(Set[2, 3, 4]) # => true Set[2, 3, 4].intersection([1, 2, 3]) # => Set[2, 3] Set[2, 3, 4].intersect?([1, 2, 3]) # => ArgumentError ``` I expect `set.intersect?(arg)` to be an optimized version of `!set.intersection(arg).empty?` Should I prepare a PR? -- https://bugs.ruby-lang.org/ Unsubscribe: