Subject: Re: how to define a local function
From: (Rob Warnock)
Date: Thu, 12 Apr 2007 22:02:53 -0500
Newsgroups: comp.lang.lisp
Message-ID: <>
Barry Margolin  <> wrote:
| (Rob Warnock) wrote:
| > Right. Actually, Scheme gets it right for a Lisp1, with LET/LET*
| > and LETREC instead of CL's LET/LET*/FLET and LABELS. But LETREC
| > and LABELS have different syntaxes and semantics. LETREC binds
| > arbitrary *values*, not functions [though in a Lisp1 a "value"
| > which is an evaluated LAMBDA expression "is" a function], while
| > LABELS binds *only* functions, like FLET.
| But the difference between LET and LETREC is only significant for the 
| function values.  But I suppose you could get cute and have things like:
| (letrec ((fun1 (lambda ...))
|          (list-of-funs (list (lambda ...)
|                              (lambda ...))))
|   ...)
| fun1 can use ((car list-of-funs) ...).

Exactly. That doesn't work for any variable-binding construct
built into CL.[1]


[1] Though as I noted, one could write a LETREC macro
    in CL that does it the same way Scheme does. The URL
    has a reference LETREC macro (in Scheme) that could be
    translated to CL fairly easily, I suspect.

Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607