Actions
Feature #13765
openAdd Proc#bind
Feature #13765:
Add Proc#bind
Status:
Open
Assignee:
-
Target version:
-
Description
Proc has curry but no method to do partial application. Something like Proc#bind might be handy.
A naive implementation might look something like
irb(main):001:0> foo = -> (first, second) { puts first, second }
=> #<Proc:0x007fc93a091f90@(irb):6 (lambda)>
irb(main):002:0> foo.bind(1).call(2)
1
2
=> nil
irb(main):003:0> foo.bind(1).bind(2).call
1
2
which does the job with the downside of only reporting argument mismatches when the returned Proc is called.
Actions