Article View: comp.lang.lisp.franz
Article #39Re: Lisp Macros
From: James A Anderson
Date: Mon, 03 Jun 1991 00:02
Date: Mon, 03 Jun 1991 00:02
33 lines
1619 bytes
1619 bytes
i must admit that i did not understand all of what
rolfl@hedda.uio.no (Rolf Lindgren) intended in
<ROLFL.91May16102939@hedda.uio.no>,
but, since two weeks have now passed since the date of the original posting,
i don't feel any qualms about correcting what appears to have been an
erroneous claim. to wit:
" Hence, a macro can only be tail-recursive (i. e. an implied for)."
there are two senses in which a macro might be recursive:
a) either the first-pass expansion contains another instance of the same
form, or
b) the code which produces the expansion contains an instance of that
form,
i do not believe that tail-recursion figures in the matter. for example:
(defmacro and-inwards (&rest forms)
(if (consp forms)
`(if (and-inwards ,@(butlast forms))
,@(last forms))
(if (null forms)
t
forms)))
is recursive in the sense of (a) and is effective, while
(defmacro or-backwards (&rest forms)
(or-backwards (and (consp forms) `(or ,@forms)) nil))
though tail recursive in the sense of (b), results in infinite recursion.
yours.
james.
Technical Details
Message-ID:
<1991Jun3.000211.20535@athena.mit.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!mintaka!bloom-picayune.mit.edu!athena.mit.edu!jansonReferences:
<1991May15.203735.3850@csusac.csus.edu> <ROLFL.91May16102939@hedda.uio.no>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.lisp.franz Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!mintaka!bloom-picayune.mit.edu!athena.mit.edu!janson From: janson@athena.mit.edu (James A Anderson) Subject: Re: Lisp Macros Message-ID: <1991Jun3.000211.20535@athena.mit.edu> Sender: news@athena.mit.edu (News system) Organization: Massachusetts Institute of Technology References: <1991May15.203735.3850@csusac.csus.edu> <ROLFL.91May16102939@hedda.uio.no> Date: Mon, 3 Jun 91 00:02:11 GMT Lines: 33