From: James Edward Gray II Date: 2007-10-26T12:03:25+09:00 Subject: Re: Skip the first invocation e.g. skip_first { foo } On Oct 25, 2007, at 9:56 PM, Ari Brown wrote: > > On Oct 25, 2007, at 7:35 PM, ara.t.howard wrote: > >> as others have mentioned you can use the block counter that's >> passed - but in general i've done things like this before: >> >> cfp:~ > cat a.rb >> block = lambda{ block = lambda{ puts 'foo' } } >> 3.times{ block.call } >> >> >> cfp:~ > ruby a.rb >> foo >> foo > > Whoa! That's pretty intense! Can you please explain how that works? > I'm totally lost to your magic. It changes what the local variable block holds on the first call. So basically, the first call is the warm-up call that builds a function to handle all future calls which do the real work. James Edward Gray II