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.7 required=3.0 tests=AWL,BAYES_00, 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 8F2671F453 for ; Thu, 4 Oct 2018 02:28:29 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 90077120A1E; Thu, 4 Oct 2018 11:28:26 +0900 (JST) Received: from o1678916x28.outbound-mail.sendgrid.net (o1678916x28.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id DB8651209F6 for ; Thu, 4 Oct 2018 11:28:24 +0900 (JST) Received: by filter0036p3las1.sendgrid.net with SMTP id filter0036p3las1-10261-5BB57AC5-19 2018-10-04 02:28:21.650471839 +0000 UTC m=+731855.068911848 Received: from herokuapp.com (ec2-54-235-37-125.compute-1.amazonaws.com [54.235.37.125]) by ismtpd0002p1sjc2.sendgrid.net (SG) with ESMTP id B5rOqQL_TXed5t_4FgUO8Q for ; Thu, 04 Oct 2018 02:28:21.495 +0000 (UTC) Date: Thu, 04 Oct 2018 02:28:22 +0000 (UTC) From: shyouhei@ruby-lang.org To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 64666 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15198 X-Redmine-Issue-Author: c4am95 X-Redmine-Sender: shyouhei 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS6nWF4siptiTV2Y3JygUeU8fGJNmaQd1rpgSr JmBDD3YoAzQ5Y5DwZ2ALw+Woyi2DgaoVxwevST53PGCcgkDnptpTHIe4coN/YJuDpvteueuM2QK8iG GK1SvIi5tN+o4Z/1RK3GzMQtG8cf883pNVX2N/NBeg8Nj0fAM5ikXvzExQ== X-ML-Name: ruby-core X-Mail-Count: 89273 Subject: [ruby-core:89273] [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 shyouhei (Shyouhei Urabe). - Interesting. Can you share a bit more detail about your "if two arrays intersect but not actually caring about the intersection" use case? For instance if you have open sourced such code, a URL for it helps us a lot. - If you have zero interest to the intersection itself I think you can avoid creating the temporary array. ---------------------------------------- Feature #15198: Array#intersect? https://bugs.ruby-lang.org/issues/15198#change-74297 * 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/