[#69616] [Ruby trunk - Feature #11258] add 'x' mode character for O_EXCL — cremno@...
Issue #11258 has been updated by cremno phobia.
3 messages
2015/06/16
[#69643] [Ruby trunk - Misc #11276] [RFC] compile.c: convert to use ccan/list — normalperson@...
Issue #11276 has been updated by Eric Wong.
3 messages
2015/06/17
[#69751] [Ruby trunk - Bug #11001] 2.2.1 Segmentation fault in reserve_stack() function. — kubo@...
Issue #11001 has been updated by Takehiro Kubo.
3 messages
2015/06/27
[ruby-core:69768] [Ruby trunk - Feature #6284] Add composition for procs
From:
mudge@...
Date:
2015-06-29 08:39:22 UTC
List:
ruby-core #69768
Issue #6284 has been updated by Paul Mucur.
Regarding the syntax: I also support `*` as the operator where `f * g = f(g(x))` (as it seems close enough to the mathematical syntax already used by other languages such as Haskell and Idris) but if that is too divisive, we could choose a method name from the mathematical definition (https://en.wikipedia.org/wiki/Function_composition) instead:
> The notation g ∘ f is read as "g circle f ", or "g round f ", or "g composed with f ", "g after f ", "g following f ", or "g of f", or "g on f ".
This opens up the following options:
* `Proc#compose`: `f.compose(g) #=> f(g(x))`
* `Proc#after`: `f.after(g) #=> f(g(x))`
* `Proc#following`: `f.following(g) #=> f(g(x))`
* `Proc#of`: `f.of(g) #=> f(g(x))`
* `Proc#on`: `f.on(g) #=> f(g(x))`
----------------------------------------
Feature #6284: Add composition for procs
https://bugs.ruby-lang.org/issues/6284#change-53146
* Author: Pablo Herrero
* Status: Feedback
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
=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--------------------------------
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)
--
https://bugs.ruby-lang.org/