From: "pabloh (Pablo Herrero)" Date: 2012-04-16T11:59:25+09:00 Subject: [ruby-core:44373] [ruby-trunk - Feature #6284] Add composition for procs Issue #6284 has been updated by pabloh (Pablo Herrero). alexeymuranov (Alexey Muranov) wrote: > > Update: i think having the both was a bad idea, it would be redundant. I was going to say the same thing. Having both #* and #| is redundant and also a bit confusing, since #| doesn't really feel to be the opposite operation of #* at any context. We should choose one or the other but not both. I still like #| (with association from left to right) a bit better, but I rather have #* than nothing. ---------------------------------------- Feature #6284: Add composition for procs https://bugs.ruby-lang.org/issues/6284#change-25917 Author: pabloh (Pablo Herrero) Status: Assigned Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: Target version: 2.0.0 =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 -- http://bugs.ruby-lang.org/