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 (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id DF19D1960004 for ; Thu, 2 Jul 2015 00:27:02 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 54B3FB5D87C for ; Thu, 2 Jul 2015 00:52:37 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (localhost.nagaokaut.ac.jp [127.0.0.1]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 4E10597A827 for ; Thu, 2 Jul 2015 00:52:40 +0900 (JST) X-Virus-Scanned: amavisd-new at nagaokaut.ac.jp Authentication-Results: funfun.nagaokaut.ac.jp (amavisd-new); dkim=fail (1024-bit key) reason="fail (message has been altered)" header.d=sendgrid.me Received: from funfun.nagaokaut.ac.jp ([127.0.0.1]) by funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id f5JRxAIPQBty for ; Thu, 2 Jul 2015 00:52:40 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id DBD0497A826 for ; Thu, 2 Jul 2015 00:52: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 AE025952439 for ; Thu, 2 Jul 2015 00:52:36 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id CA629120461; Thu, 2 Jul 2015 00:52:33 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o2.heroku.sendgrid.net (o2.heroku.sendgrid.net [67.228.50.55]) by neon.ruby-lang.org (Postfix) with ESMTPS id 21DB3120419 for ; Thu, 2 Jul 2015 00:52:29 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=+JZxJ2prCqtpyd6tactMZBEG/3U=; b=KCtERrkihDcwceNXpk jAI8+/dY9lVnbwu60iMnJ0+r7xW8JRlwzS/aNXFP7Jb/GDPFzy5wp5oGarKuHbWf 5tUpeSusnmlD12ybyxtcMMh5onDhwZsXsw3gHlH0hLISZkZJ2KqquzRAl93BnSMW Yhe7MePv2GNWDeKy7sYLFbhqU= Received: by filter0423p1mdw1.sendgrid.net with SMTP id filter0423p1mdw1.27127.55940CB6B 2015-07-01 15:52:22.336422125 +0000 UTC Received: from herokuapp.com (ec2-54-204-246-107.compute-1.amazonaws.com [54.204.246.107]) by ismtpd-043 (SG) with ESMTP id 14e4a51a78c.6d62.8896c3 Wed, 01 Jul 2015 15:52:22 +0000 (UTC) Date: Wed, 01 Jul 2015 15:52:21 +0000 From: tom@codon.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Redmine-MailingListIntegration-Message-Ids: 44430 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 6284 X-Redmine-Issue-Author: pabloh X-Redmine-Issue-Assignee: matz X-Redmine-Sender: tomstuart 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/Ymy4QrNMhiuLXJG8OTL2vJD1yS70FUUCnf56KcObyPf6sA5KWA2N0oCJUIklom CpmvAQWFi/RF4QKGn6RVzjFCDUpnpuO2ay2bDkSmvDKfdnjcVM+AdzMlXimG4JO+eKrQRgsoqoBLuM EzQatE+0zCLBFWZkgm15J1RqLn65NAPcHf3+ X-ML-Name: ruby-core X-Mail-Count: 69833 Subject: [ruby-core:69833] [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: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #6284 has been updated by Tom Stuart. I support the proposed `Proc#*`/`Method#*` syntax and semantics. The feature being added is **function composition**; not relation compositi= on, not method chaining. Its target audience is most likely to read `f * g`= as =E2=80=9C`f` after `g`=E2=80=9D, so that=E2=80=99s how it should work. = Perhaps some Ruby programmers will not use this feature directly (as with `= Proc#curry`) because they neither program nor think in a functional style, = but it should be designed to be useful and familiar to those who do. The pr= oposed implementation achieves that. The asterisk isn=E2=80=99t ideal, but it=E2=80=99s the best choice availabl= e. ---------------------------------------- Feature #6284: Add composition for procs https://bugs.ruby-lang.org/issues/6284#change-53231 * Author: Pablo Herrero * Status: Feedback * Priority: Normal * Assignee: Yukihiro Matsumoto ---------------------------------------- =3Dbegin It would be nice to be able to compose procs like functions in functional p= rogramming languages: to_camel =3D :capitalize.to_proc add_header =3D ->val {"Title: " + val} format_as_title =3D add_header << to_camel << :strip instead of: format_as_title =3D 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 =3Dend ---Files-------------------------------- 0002-proc.c-Implement-Method-for-Method-composition.patch (2.71 KB) 0001-proc.c-Implement-Proc-for-Proc-composition.patch (3.73 KB) 0003-proc.c-Support-any-callable-when-composing-Procs.patch (4.01 KB) --=20 https://bugs.ruby-lang.org/