George Neuner <gneuner2/@/comcast.net> wrote:
+
 rpw3@rpw3.org (Rob Warnock) wrote:
 >Well, true, but you can keep the internal name from escaping by
 >returning the function value, making it effectively "anonymous":
 >
 > > (funcall
 > (labels ((self (x) (if (< x 2) 1 (* x (self (1 x)))))) #'self)
 > 5)
 >
 > 120
 > >

 Yes, I suppose that is anonymous in the way John intended.

 It's a little more verbose in Scheme:

 ((lambda (x)
 (let self ((x x))
 (if (< x 2) 1 (* x (self ( x 1))))))
 5)
 120

 but I think the Scheme makes it a little clearer that there is a named
 self referential function in an anonymous wrapper.
+
That's using the "named LET", though you also can do it in Scheme
almost exactly the same way I did in CL, by using LETREC instead
of LABELS and leaving off the FUNCALL:
> ((letrec ((self (lambda (x) (if (< x 2) 1 (* x (self (1 x)))))))
self)
5)
120
>
Rob

Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)5722607