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=-3.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 3B09F1F461 for ; Wed, 4 Sep 2019 14:18:29 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 6C5B7120A77; Wed, 4 Sep 2019 23:18:21 +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 329C9120A74 for ; Wed, 4 Sep 2019 23:18:17 +0900 (JST) Received: by filter0128p3las1.sendgrid.net with SMTP id filter0128p3las1-3351-5D6FC7AB-B4 2019-09-04 14:18:19.921600903 +0000 UTC m=+78675.282046805 Received: from herokuapp.com (unknown [35.153.73.163]) by ismtpd0015p1iad2.sendgrid.net (SG) with ESMTP id lbVcFpKzQ7iPle7v4hanCQ for ; Wed, 04 Sep 2019 14:18:19.897 +0000 (UTC) Date: Wed, 04 Sep 2019 14:18:20 +0000 (UTC) From: daniel@dan42.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 70331 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15198 X-Redmine-Issue-Author: c4am95 X-Redmine-Sender: Dan0042 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-SG-EID: =?us-ascii?Q?8sy4RigFvRTdBfCVJrT9zb2J88PC92TMQwdNgaWYaq5NmDp0iaYozpoGHawYLn?= =?us-ascii?Q?pgc6BLUJTEpxbZsLVuUFk7SZqYu+=2FGx4kQj3NXq?= =?us-ascii?Q?yWrjMMPwL3kAQ5hYr205QpLIMIrq=2F1FkifwCWAe?= =?us-ascii?Q?qveQI2HTyof4Ar08GFEMLmE9n7HzfIhUUZOLOPc?= =?us-ascii?Q?zH6YTLjK0PhSRKHAAQKatfBq01Owm1YIhlQ=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 94776 Subject: [ruby-core:94776] [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 Dan0042 (Daniel DeLorme). It might make sense to use `ary1.to_set.intersect?(ary2)`. That way it makes explicit the fact that ary1 must be converted to a set. But `Set#intersect?` would have to support any Enumerable. ---------------------------------------- Feature #15198: Array#intersect? https://bugs.ruby-lang.org/issues/15198#change-81394 * Author: c4am95 (Travis Hunter) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- 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/