7 ms·
Conspicuously missing is the brilliant new Proc.curry method! For those that don't know currying is a method that returns another Proc with one fewer argument,
by pyrhho 16y ago
Conspicuously missing is the brilliant new Proc.curry method!
For those that don't know currying is a method that returns another Proc with one fewer argument, so you can do:
multiply = Proc.new { |x, y| x * y }
multiply_by_five = multiply.curry(5)
multiply_by_five.call(3) # => 15
- deleted 16y ago[deleted]