MikkelFJ wrote:

> What remains then is partial evaluation:

I think I wrote something like that a while back, just to see if I
could. Never used it much, though. :)


class Object
  def curry(symbol, *fixedArgs)
    lambda { |*args| method(symbol).call(*(fixedArgs + args)) }
  end
end

def sum(a, b)
  a + b
end

plus4 = curry(:sum, 4)
p plus4.call(8)   # => 12

arrayOfFive = Array.curry(:new, 5)
p arrayOfFive.call("A")   # => ["A", "A", "A", "A", "A"]


Is this the kind of thing you were looking for?


Adam Spitz