Module: FunRuby::Function
Overview
Module for useful manipulations with functions
Class Method Summary collapse
-
.compose(required = F._, *functions) ⇒ #call
Performs right-to-left function composition.
- .curry(function = F._) ⇒ Object
-
.pipe(required = F._, *functions) ⇒ #call
Performs left-to-right function composition.
Instance Method Summary collapse
-
#compose(required = F._, *functions) ⇒ #call
Performs right-to-left function composition.
- #curry(function = F._) ⇒ Object
-
#pipe(required = F._, *functions) ⇒ #call
Performs left-to-right function composition.
Class Method Details
.compose(required = F._, *functions) ⇒ #call
Performs right-to-left function composition
48 49 50 |
# File 'lib/fun_ruby/function.rb', line 48 def compose(required = F._, *functions) curry(method(:_compose)).(required, *functions) end |
.curry(function = F._) ⇒ Object
105 106 107 |
# File 'lib/fun_ruby/function.rb', line 105 def curry(function = F._) handling_placeholders(method(:_curry).curry, [function]) end |
.pipe(required = F._, *functions) ⇒ #call
Performs left-to-right function composition
89 90 91 |
# File 'lib/fun_ruby/function.rb', line 89 def pipe(required = F._, *functions) curry(method(:_pipe)).(required, *functions) end |
Instance Method Details
#compose(required = F._, *functions) ⇒ #call
Performs right-to-left function composition
48 49 50 |
# File 'lib/fun_ruby/function.rb', line 48 def compose(required = F._, *functions) curry(method(:_compose)).(required, *functions) end |
#curry(function = F._) ⇒ Object
105 106 107 |
# File 'lib/fun_ruby/function.rb', line 105 def curry(function = F._) handling_placeholders(method(:_curry).curry, [function]) end |
#pipe(required = F._, *functions) ⇒ #call
Performs left-to-right function composition
89 90 91 |
# File 'lib/fun_ruby/function.rb', line 89 def pipe(required = F._, *functions) curry(method(:_pipe)).(required, *functions) end |