module Fn::Composable
Public Instance Methods
comp(g)
click to toggle source
Functional composition, f ยท g
# File lib/fn.rb, line 16 def comp(g) Fn { |*a, &b| call(g.call(*a, &b)) } end
lapply(*l)
click to toggle source
Bind (partially apply) parameters from the left
# File lib/fn.rb, line 32 def lapply(*l) Fn { |r, &b| call(*l, *r, &b) } end
Also aliased as: <<
pipe(g)
click to toggle source
# File lib/fn.rb, line 24 def pipe(g) Fn { |*a, &b| g.call(call(*a, &b)) } end
Also aliased as: |
rapply(*r)
click to toggle source
Bind (partially apply) parameters from the right
# File lib/fn.rb, line 40 def rapply(*r) Fn { |*l, &b| call(*l, *r, &b) } end
Also aliased as: >>