From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.1 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id D10A91F97E for ; Mon, 8 Oct 2018 17:10:13 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id B532F120D90; Tue, 9 Oct 2018 02:10:11 +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 4EA71120D85 for ; Tue, 9 Oct 2018 02:10:09 +0900 (JST) Received: by filter0083p3mdw1.sendgrid.net with SMTP id filter0083p3mdw1-17104-5BBB8F6D-22 2018-10-08 17:10:05.745075114 +0000 UTC m=+236090.897159464 Received: from herokuapp.com (ec2-23-23-15-115.compute-1.amazonaws.com [23.23.15.115]) by ismtpd0010p1iad1.sendgrid.net (SG) with ESMTP id rCrLGQACQOWevjPXeTZ-hA for ; Mon, 08 Oct 2018 17:10:05.715 +0000 (UTC) Date: Mon, 08 Oct 2018 17:10:06 +0000 (UTC) From: c4am95@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 64714 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15198 X-Redmine-Issue-Author: c4am95 X-Redmine-Sender: c4am95 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: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS7PK4HVZ/Jibyd2FGnjgfKFB0c5QPmcvAycxv Dk1qOLSr2piBpdjDGeDj8SD50Ofz2NlSmJ4x4z/tIyv7EcFKam1gYx6xsM769pULr+hNv6xQpOpfYI ihDNa7MJxwEQFee1isEADFLJm5tL6LTrNeHaIVgY1u1eiFrIlVgemZUZuA== X-ML-Name: ruby-core X-Mail-Count: 89321 Subject: [ruby-core:89321] [Ruby trunk 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 c4am95 (Travis Hunter). It also seems like it comes up fairly commonly on stackoverflow/blogs: https://stackoverflow.com/questions/2603895/how-can-i-check-if-a-ruby-array-includes-one-of-several-values https://www.ruby-forum.com/t/find-if-an-array-has-any-element-present-in-another-array/166877 https://irb.rocks/comparison-arrays-ruby/ https://tosbourn.com/set-intersection-in-ruby/ ---------------------------------------- Feature #15198: Array#intersect? https://bugs.ruby-lang.org/issues/15198#change-74350 * 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/