From: Brian Candler Date: 2003-03-27T20:44:22+09:00 Subject: Re: What are the differences between Ruby's blocks and Python's lambdas? On Thu, Mar 27, 2003 at 06:00:09PM +0900, Mauricio Fern�ndez wrote: > ahah, I was thinking the other way around, sorry :-) > Something like "how do I call a proc the same way as a method (downcase)?" > ie., some way to do > pp = proc { |x| x + 1 } > .... MAGIC .... > pp(1) I think what you want is to add a singleton method to the current object (self), but one which is able to reference the local variable 'pp'. I'd be interested to know how to do that, too. You can do this: self.class.instance_eval { define_method(:pp, pp) } pp(9) # >> 10 but that adds pp to the class, rather than the current object. Regards, Brian.