Ruby: convert proc to lambda?
Is it possible to convert a proc-flavored Proc into a lambda-flavored Proc? Bit surprised that this doesn't work, at least in 1.9.2: my_proc = proc {|x| x} my_lambda = lambda &p my_lambda.lambda? # => false! This one was a bit tricky to track down. Looking at the docs for Proc#lambda? for 1.9 , there's a fairly lengthy discussion about the difference between proc s and lamdba s. What it comes down to is that a lambda enforces the correct number of arguments, and a proc doesn't. And from that documentation, about the only way to convert a proc into a lambda is shown in this example: define