Sylvain Joyeux wrote:
> Blocks and lambdas behave differently w.r.t. flow operators, because blocks
> are to be used in loop-like constructs while lambdas are real functions
>
> For instance, you can implement Enumerable#find using
>
> module Enumerable
> 	def find
> 		self.each { |x|
> 			return x if yield(x)
> 		}
> 	end
> end
>
> But you can't use a lambda in the same way. IMO you would have to use
> throw/catch constructs. I prefer the return way but that's a matter of
> taste.

I don't see the difference to which you are referring. What "flow
operators"?

Again, as far as I can tell a block is simply a lambda. The loop
recalls that lambda over and over.

  module Enumerable
    def find
      lamb = lambda { |x| return x if yield(x) }
      self.each &lamb
    end
   end

T.