On Thu, 5 Sep 2002, Alan Chen wrote: > On Fri, Sep 06, 2002 at 02:08:19AM +0900, Tobias Peters wrote: > > def sqrt(x) [...] > > def o.improve(guess) > > average(guess, x/guess) > > end > > def o.sqrt_iter(g1,g2) > > good_enough(g1,g2) ? g2 : sqrt_iter(g2, improve(g2)) > > end > > o.sqrt_iter(1.0, 2.0) > > end This was an error -- nested defs are not lexical closures, as it turns out, so this fails when evaluating x in "improve". > Most defs within defs can also be resolved using procs. This was the starting point (using lambda instead of proc). I wanted to replace the [] with (). Tobias