From: Intransition Date: 2010-09-27T23:22:06+09:00 Subject: Re: Get Proc of current block? On Aug 27, 1:27 am, Michael Fellinger wrote: > That's called the Y-combinator, something i wish could be added to > core, but would be afraid of the many nay-sayers who are already > confused by the current number of ways of creating blocks :) > > def y(*args, &block) >   y = lambda{|*args| block.(*args, &y) } > end > > p y{|n, acc, &b| >   n < 2 ? acc : b.(n-1, n * acc) > > }.(5, 1) Helpful. Thanks. I am considering adding to Facets, but it would have to be called #Y b/c YAML defines #y.