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=-2.6 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=no 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 BB5691F462 for ; Fri, 14 Jun 2019 03:40:33 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 9D84E120B46; Fri, 14 Jun 2019 12:40:27 +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 53088120B46 for ; Fri, 14 Jun 2019 12:40:25 +0900 (JST) Received: by filter0062p3iad2.sendgrid.net with SMTP id filter0062p3iad2-25662-5D03172A-22 2019-06-14 03:40:26.785575584 +0000 UTC m=+816398.851484363 Received: from herokuapp.com (unknown [107.21.31.174]) by ismtpd0002p1iad1.sendgrid.net (SG) with ESMTP id 4wzKjTxJQkqDJysLMmrF8A for ; Fri, 14 Jun 2019 03:40:26.608 +0000 (UTC) Date: Fri, 14 Jun 2019 03:40:26 +0000 (UTC) From: kachick1@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 68614 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15922 X-Redmine-Issue-Author: kachick X-Redmine-Sender: kachick 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?G2yWLd+gi9jc4PPtpoK6mpikIYt4j5zNU+48fSFxu8=2Fjiso3WWyBU4NEQWIOgM?= =?us-ascii?Q?GCZ16Ti7XgG770gewx4C36V2VMA8y0OEZh62sQV?= =?us-ascii?Q?vV8v3DtLUq6psbyCJCsSDV=2Fas0LhVXk9kUhxQXn?= =?us-ascii?Q?yVqDu0TCnfYWhv6T89xVNdrgY1=2FUNDu17jcZmv3?= =?us-ascii?Q?GF1PKCoGU+o6Af7eKy2UoydcMEopeQGIHjw=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 93128 Subject: [ruby-core:93128] [Ruby trunk Feature#15922] Enumerable#partition(pattern) 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 #15922 has been reported by kachick (Kenichi Kamiya). ---------------------------------------- Feature #15922: Enumerable#partition(pattern) https://bugs.ruby-lang.org/issues/15922 * Author: kachick (Kenichi Kamiya) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- * `any?` `all?` `one?` `none?` already can take pattern argument. ref: https://bugs.ruby-lang.org/issues/11286 * `select` `reject` is proposed to take pattern argument. ref: https://bugs.ruby-lang.org/issues/14197 I would like to use `partition` with pattern argument for consistency. ```ruby module Enumerable alias_method :original_partition, :partition def partition(*args, &block) case args.size when 1 pattern = args.first original_partition do |element| pattern === element end when 0 original_partition(&block) else raise ArgumentError end end end [1, 2, 3.3, 4, 5.5].partition(Integer) #=> => [[1, 2, 4], [3.3, 5.5]] ``` -- https://bugs.ruby-lang.org/