Re: Tail recursion syntactic sugar faked with TAGBODY-based construct?
- From: Kaz Kylheku <kkylheku@xxxxxxxxx>
- Date: Thu, 31 Jan 2008 14:07:40 -0800 (PST)
On Jan 31, 5:45 am, Klaus Harbo <kl...@xxxxxxxxx> wrote:
Cute macro. However, TAILPROG relies on NREVERSE not messing up ARGTAGS-FORMS and MACROLET-ELEMS (which it is permitted
to do according to the standard), in LW5.1-beta I get
CL-USER 12 > (let ((list '(1 2 3)))
(values (nreverse list)
list))
Yes of course. NREVERSE can rearrange the CONS structure without
moving around the CAR fields.
Of course, I intended this:
(setf argtags-forms (nreverse argtags-forms))
my Lisp just let me get away without the SETF, because it implements
reversal by reshuffling CAR's.
`(macrolet ,(reverse macrolet-elems)
(let ,let-bindings
(argtags nil
(return (progn ,@forms))
,@(reverse argtags-forms))))))
instead -- that seems to work.
NREVERSE should also work here. But then if I'm going to obsess over
consing in REVERSE, then to be consistent I should also be using ,.
rather than ,@ for instances of splicing not in a tail position.
.
- References:
- Tail recursion syntactic sugar faked with TAGBODY-based construct?
- From: Kaz Kylheku
- Re: Tail recursion syntactic sugar faked with TAGBODY-based construct?
- From: Pascal Costanza
- Re: Tail recursion syntactic sugar faked with TAGBODY-based construct?
- From: Kaz Kylheku
- Re: Tail recursion syntactic sugar faked with TAGBODY-based construct?
- From: Kaz Kylheku
- Re: Tail recursion syntactic sugar faked with TAGBODY-based construct?
- From: Klaus Harbo
- Tail recursion syntactic sugar faked with TAGBODY-based construct?
- Prev by Date: Re: adjustable array vs hash-table
- Previous by thread: Re: Tail recursion syntactic sugar faked with TAGBODY-based construct?
- Next by thread: Re: Tail recursion syntactic sugar faked with TAGBODY-based construct?
- Index(es):
Relevant Pages
|