Hunt Jon wrote:
> I'm new to Ruby with PHP background.
> 
> * Is there any super easy explanation or tutorial for proc and lamda?
> * Do I need experience with Lisp or Smalltalk?
> 
> Proc and lambda are most fun part in ruby, people say. But, I feel I'm
> dumb. I read the Pickaxe book, but couldn't fully understand the
> concept. I don't have to be able to use them soon, but I at least need
> to comprehend them.
> 
> -J

This bothered me for the longest time and the clearest description I've 
encountered is in the O'Reilly book The Ruby Programming Language.

"A proc is an object form of a block, and it behaves like a block. A 
lambda has slightly modified behavior and behaves more like a method 
than a block." p. 197

Briefly, they respond differently to return and break. A return executed 
in a proc returns not only from the block but any enclosing methods as 
well. A return in a Lambda only returns from the lambda (i.e. the 
analogy to a method).

There's more on breaks, next, etc in the book. The best coverage I've 
seen on intermediate and advanced Ruby concepts and very readable. Check 
it out...
-- 
Posted via http://www.ruby-forum.com/.