Newsgroups: comp.lang.lisp.franz
Path: 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

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.
