Module: Rupture::Fn

Included in:
Array, Hash, Method, Proc, Set, Symbol
Defined in:
lib/rupture/fn.rb

Instance Method Summary collapse

Instance Method Details

#arityObject



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

#complementObject 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_procObject

def apply(*args)

last = args.pop
call(*F.concat(args, last))

end



30
31
32
33
34
# File 'lib/rupture/fn.rb', line 30

def to_proc
  lambda do |key|
    self[key]
  end
end