Module: Rupture::Fn
Instance Method Summary collapse
- #arity ⇒ Object
- #comp(fn) ⇒ Object (also: #*)
- #complement ⇒ Object (also: #-@)
- #partial(*partials) ⇒ Object
-
#to_proc ⇒ Object
def apply(*args) last = args.pop call(*F.concat(args, last)) end.
Instance Method Details
#arity ⇒ Object
36 37 38 |
# File 'lib/rupture/fn.rb', line 36 def arity -1 end |
#comp(fn) ⇒ Object Also known as: *
12 13 14 15 16 |
# File 'lib/rupture/fn.rb', line 12 def comp(fn) lambda do |*args| call(fn[*args]) end end |
#complement ⇒ Object Also known as: -@
5 6 7 8 9 |
# File 'lib/rupture/fn.rb', line 5 def complement lambda do |*args| not call(*args) end end |
#partial(*partials) ⇒ Object
19 20 21 22 23 |
# File 'lib/rupture/fn.rb', line 19 def partial(*partials) lambda do |*args| call(*(partials + args)) end end |
#to_proc ⇒ Object
30 31 32 33 34 |
# File 'lib/rupture/fn.rb', line 30 def to_proc lambda do |key| self[key] end end |