As mentioned elsewhere, is this currying? Or partial application?<p>Currying:<p>lambda { |x,y| x + y }.curry => lambda { |x| lambda { |y| x + y } }<p>Partial Application<p>lambda { |x, y| x + y }.apply(2) => lambda { |y| 2 + y }<p>And given #curry, #apply is trivial:<p>class Proc; def apply(param); self.curry.call(param); end end<p>...or at least, that's <i>my</i> understanding...
After learning about these concepts in Haskell, the Ruby code seems downright ugly (I never thought I'd say that)... but still probably quite useful in some cases.