From: ptkwt@...1.aracnet.com (Phil Tomson) Date: 2003-03-28T06:55:01+09:00 Subject: Re: What are the differences between Ruby's blocks and Python's lambdas? In article <20030327184433.A14861@linnet.org>, Brian Candler wrote: >On Thu, Mar 27, 2003 at 11:19:09PM +0900, ts wrote: >> def addmeth(m,x) >> class << self; self end.instance_eval { define_method(m,x) } >> end > >I apologise, I missed that because at a glance it seemed to be what I had >written. > >I had no idea that you could use the result of 'class...end' in that way... >neat! > > pp = proc { |x| x+1 } > addmeth(:pp,pp) > pp(3) # >> 4 > >Wonderful. > >Cheers, I guess I'm not quite catching this.... but there does seem to be something quite useful here. Could someone write this up on the wiki? Phil