Subject: Re: CL idiom for Scheme's named let
From: rpw3@rpw3.org (Rob Warnock)
Date: Wed, 23 Nov 2005 22:30:14 -0600
Newsgroups: comp.lang.lisp
Message-ID: <v-CdnYD0FPZL3BjeRVn-uA@speakeasy.net>
Bruce Butterfield <bruce@open-tek.com> wrote:
+---------------
| The more general question I had, however, I'll restate: is there a
| more 'CL-like' way to do this or is the answer to mimic named let?
+---------------

No, using LABELS as a transliteration of named-LET is perfectly
fine, provided that you don't depend on the tail-call optimization
property that Scheme promises with named-LET.

Actually, LABELS is really closer to Scheme's LETREC, in that
it allows mutual recursion between more than one function (which
named-LET doesn't!). But LABELS isn't a perfect direct translation
of LETREC, since the latter can be used to bind *both* function
and variable values, whereas in CL those need separate forms.
So you might have to do a bit of data flow analysis to tease
apart a horrendously-complex LETREC into an equivalent set of
nested LET & LABELS forms.


-Rob

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