Lambda vs Proc


#1

“A lambda is just like a proc, only it cares about the number of arguments it gets and it returns to its calling method rather than returning immediately.”

Can anyone explain what this means and when to use lambdas or procs? I still don’t get it after reading articles on it. The part I don’t understand is why lambda only returns the last line. If I have a lambda that has 100 lines, my understanding is that it will only return the 100th line and ignore all previous. But why would you want to do this?

http://awaxman11.github.io/blog/2013/08/05/what-is-the-difference-between-a-block/


#2

A lambda is like an iterator that cannot be terminated. A proc can be. This bears proving out, so see if this comparison has any bearing.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.