On Mon, Sep 19, 2005 at 06:23:23PM +0900, Brian Candler wrote:
> I want the object to be self-contained. 'self' doesn't work. Best I can come
> up with is to try and hide it:
> 
>   a = __myfoo = lambda { |x| x < 2 ? 1 : x * __myfoo.call(x-1) }

You can use the Y combinator or something as simple as

#  make sure _l is block-local
a = lambda{ _l = lambda{|x| x < 2 ? 1 : x * _l[x-1]}}[] 
p a[5]
_l = 1 # doesn't matter
p a[5]

-- 
Mauricio Fernandez