From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 56E671F934 for ; Fri, 16 Apr 2021 07:03:26 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id F1E7D120D31; Fri, 16 Apr 2021 16:02:23 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id 36743120CFD for ; Fri, 16 Apr 2021 16:02:21 +0900 (JST) Received: by filterdrecv-7bbb56ff7b-dk7zf with SMTP id filterdrecv-7bbb56ff7b-dk7zf-14-607936B9-2B 2021-04-16 07:03:21.245367516 +0000 UTC m=+38416.769879367 Received: from herokuapp.com (unknown) by geopod-ismtpd-6-0 (SG) with ESMTP id ctHxFqW0Rpq2wwcpQH0AYw for ; Fri, 16 Apr 2021 07:03:21.098 +0000 (UTC) Date: Fri, 16 Apr 2021 07:03:21 +0000 (UTC) From: knu@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 15198 X-Redmine-Issue-Author: c4am95 X-Redmine-Issue-Assignee: matz X-Redmine-Sender: knu X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-Redmine-MailingListIntegration-Message-Ids: 79522 X-SG-EID: =?us-ascii?Q?hDsQvKErLSJ7pAc+tDc0a0gaAYeRBj5seyyxgbnjKEk5mgCjBCAq4ggolErN9L?= =?us-ascii?Q?jnVNxDPfEyPK=2FxCM320wN0mf1F7p2dg6H5GU4G1?= =?us-ascii?Q?2vfg7gEmZkZR0PZwlXURf+3EQ5GvRq4mxrjNp0N?= =?us-ascii?Q?WE9WCiTMcVYmzq+KWtUIVmcrrIS3I0mMbDCJt+P?= =?us-ascii?Q?pU+nNJNSogombc77sRtTEp4pWVBOYVUz=2FgA=3D=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 103475 Subject: [ruby-core:103475] [Ruby master Feature#15198] Array#intersect? X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "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/