Class Proc
In: lib/prelude.rb
Parent: Object

Methods

**   curry  

External Aliases

call -> ~
  Syntaxic sugar for something like this: ~head(list), i.e., gives actual head instead of proc that can do it if called.

Public Instance methods

This is will serve as an infix composition operator for procs. If between two procs, returns composition proc, executes left proc otherwise.

[Source]

     # File lib/prelude.rb, line 99
 99:   def **(*args)
100:     if (1==args.length) && args[0].is_a?(Proc)
101:       lambda {|*a| self.call(args[0].call(*a)) }
102:     else
103:       self.call(*args.flatten)
104:     end
105:   end

FIXIT

[Source]

    # File lib/prelude.rb, line 93
93:   def curry(one, *args)
94:     lambda { |*args| self.call(one, *args)}
95:   end