From: Kenneth Liu
Subject: Named LETs in Common Lisp
Date: 
Message-ID: <69lorr$un3$1@news.fas.harvard.edu>
I'm new to both Scheme and Common Lisp, so if this is a stale
and irrelevant question, I apologize (i didn't find it in the 
FAQ).

I just learned about named LETs in Scheme and find them very
useful as ways to express tail-recursive algorithms.  So I'm
wondering, is there an equivalent construction in CL?  And if
not, why was the decision made not to incorporate this
feature into CL?  (I'm not saying it "should", just wondering
why)

Also, I tried to write a macro to implement named LETs in 
CL.  My attempt appears below.  So far it has worked fine
for me, but I'm wondering if I made some mistake in efficiency
or correctness that I'm not aware of.  Any advice would
be appreciated.

--

Ken

From: Kenneth Liu
Subject: Re: Named LETs in Common Lisp
Date: 
Message-ID: <69louq$un3$2@news.fas.harvard.edu>
oops, forgot to post the code.  (this is my macro for
named LETs in CL)


(defmacro named-let (label args &rest body)
  `(labels ((,label ,(mapcar  #'car args) ,@body))
	 (,label ,@(mapcar #'cad args))))

Ken


Kenneth Liu <·····@fas.harvard.edu> wrote:
: I'm new to both Scheme and Common Lisp, so if this is a stale
: and irrelevant question, I apologize (i didn't find it in the 
: FAQ).

: I just learned about named LETs in Scheme and find them very
: useful as ways to express tail-recursive algorithms.  So I'm
: wondering, is there an equivalent construction in CL?  And if
: not, why was the decision made not to incorporate this
: feature into CL?  (I'm not saying it "should", just wondering
: why)

: Also, I tried to write a macro to implement named LETs in 
: CL.  My attempt appears below.  So far it has worked fine
: for me, but I'm wondering if I made some mistake in efficiency
: or correctness that I'm not aware of.  Any advice would
: be appreciated.

: --

: Ken

-- 
________________________________________________________________________
while she died, while she died,
i listened to women singing.
your words then fell into me,
like stones raining on the ground.                         -- LBH
________________________________________________________________________
From: Barry Margolin
Subject: Re: Named LETs in Common Lisp
Date: 
Message-ID: <gYvv.5$5F2.39165@cam-news-reader1.bbnplanet.com>
In article <············@news.fas.harvard.edu>,
Kenneth Liu  <·····@fas.harvard.edu> wrote:
>I just learned about named LETs in Scheme and find them very
>useful as ways to express tail-recursive algorithms.  So I'm
>wondering, is there an equivalent construction in CL?  And if
>not, why was the decision made not to incorporate this
>feature into CL?  (I'm not saying it "should", just wondering
>why)

No such decision was made, because I don't think anyone ever proposed it.
Named LETs tend to go hand in hand with tail call optimization, which CL
doesn't require.

-- 
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Cambridge, MA
Support the anti-spam movement; see <http://www.cauce.org/>
Please don't send technical questions directly to me, post them to newsgroups.