What are the differences between a proc and lambda?
Key differences between proc and lambda?
What is a la开发者_如何学JAVAmbda and what is a proc?
And how are they each used?
Just found few links. These might be helpful for you -
http://www.skorks.com/2010/05/ruby-procs-and-lambdas-and-the-difference-between-them/
also possible duplicate of -
When to use lambda, when to use Proc.new?
additionally taken from the below link -
lambda handles arguments exactly as a Ruby method; pass less or more arguments than the function expects, and you get an ArgumentError. Proc.new tolerates errors; if you call it with less arguments than specified, the rest are set to nil; if you specify more, the ones in excess are ignored.
http://raulparolari.com/Ruby2/lambda_Proc
精彩评论