Re: gensym in macro definition
- From: Stephen Compall <stephen.compall@xxxxxxxxx>
- Date: Thu, 31 Aug 2006 04:55:17 GMT
Guybrush Threepwood wrote:
(defmacro n-of (n expression)
(let ((i (gensym)))
`(loop for ,i from 1 to ,n
collect ,expression)))
I wonder if the gensym is really necessary. According to the rules for
detecting variable capture in Graham's On Lisp I think it is. Am I right?
It is necessary for the code you have output. For extra fun find the
loop-clause that will let LOOP do this without an explicit variable.
--
Stephen Compall
http://scompall.nocandysw.com/blog
.
- Follow-Ups:
- Re: gensym in macro definition
- From: Guybrush Threepwood
- Re: gensym in macro definition
- References:
- gensym in macro definition
- From: Guybrush Threepwood
- gensym in macro definition
- Prev by Date: What is Juho's Problem Anyway? [was Re: Lets talk about GUI and sound libraries]
- Next by Date: Re: gensym in macro definition
- Previous by thread: gensym in macro definition
- Next by thread: Re: gensym in macro definition
- Index(es):