From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (smtp.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 1C7CC1B61198 for ; Mon, 13 Mar 2017 16:40:19 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 9C861B5D995 for ; Mon, 13 Mar 2017 17:13:39 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 1646018CC818 for ; Mon, 13 Mar 2017 17:13:40 +0900 (JST) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 1C0981206F3; Mon, 13 Mar 2017 17:13:39 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org 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 0A4341206D5 for ; Mon, 13 Mar 2017 17:13:35 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=F27mqxo0pRq+wcy0M9UIy8HwzFA=; b=XWyIADkC1fp7hTqsyk xh/WQetUPeM/yJpQ02JGU/OBCbT01ETbK7nVEVugmR50jixZuFiHPTEv+TVWUdCr SGpqIpqaxW7Onv1YKeFAxtapCYR9PR2TbQM6eamMOmglyNGZg+19njxjmtJkW55C Ux5wrFBhgYdqG8aR4A/Y1nkQk= Received: by filter0824p1mdw1.sendgrid.net with SMTP id filter0824p1mdw1-6898-58C654AC-3 2017-03-13 08:13:32.073390636 +0000 UTC Received: from herokuapp.com (ec2-54-211-102-92.compute-1.amazonaws.com [54.211.102.92]) by ismtpd0003p1iad1.sendgrid.net (SG) with ESMTP id AwpvWNH_RzC-fql_98us2A Mon, 13 Mar 2017 08:13:32.066 +0000 (UTC) Date: Mon, 13 Mar 2017 08:13:31 +0000 From: matz@ruby-lang.org To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 55055 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 6284 X-Redmine-Issue-Author: pabloh X-Redmine-Issue-Assignee: matz X-Redmine-Sender: matz 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS7uUdVa4m019pAdKORCKMGSheBS/1Bw2HQfq2 ckYiZWHSS+POW773IfFPgm3BpTpRL3q1vjlY9a6egc6/5Xfzgzl5hQqh3HtSSG7VzQPVPlQA8zePTZ P07nfMvTuhwP5sGre4KqwfzD0YT9h4CovBkZHaEwJDw7imNem0ewzFqnYw== X-ML-Name: ruby-core X-Mail-Count: 80110 Subject: [ruby-core:80110] [Ruby trunk Feature#6284] Add composition for procs 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 #6284 has been updated by Yukihiro Matsumoto. I want to make sure if everyone agrees with "*" instead of OP's "<<". Besides that I also wanted to mention that Koichi concerns that function composition may be far slower than method chaining. Matz. ---------------------------------------- Feature #6284: Add composition for procs https://bugs.ruby-lang.org/issues/6284#change-63536 * Author: Pablo Herrero * Status: Feedback * Priority: Normal * Assignee: Yukihiro Matsumoto * Target version: ---------------------------------------- =begin It would be nice to be able to compose procs like functions in functional programming languages: to_camel = :capitalize.to_proc add_header = ->val {"Title: " + val} format_as_title = add_header << to_camel << :strip instead of: format_as_title = lambda {|val| "Title: " + val.strip.capitalize } It's pretty easy to implement in pure ruby: class Proc def << block proc { |*args| self.call( block.to_proc.call(*args) ) } end end =end ---Files-------------------------------- 0001-proc.c-Implement-Proc-for-Proc-composition.patch (3.65 KB) 0002-proc.c-Implement-Method-for-Method-composition.patch (2.67 KB) 0003-proc.c-Support-any-callable-when-composing-Procs.patch (3.97 KB) -- https://bugs.ruby-lang.org/