Hi all,
I'm learning Lisp by reading Practical Common Lisp. I have a question regarding gensym.
The book presents on chapter 9 the macro with-gensyms:
Thanks in advance.
I'm learning Lisp by reading Practical Common Lisp. I have a question regarding gensym.
The book presents on chapter 9 the macro with-gensyms:
(defmacro with-gensyms ((&rest names) &body body)
`(let ,(mapcar (lambda (x) `(,x (gensym))) names) ,@body))
It's fine. I understand how it works. I would like to know if there's any drawback in reimplementing it like this:(defmacro with-gensyms ((&rest names) &body body)
`(let ,(mapcar (lambda (x) `(,x ',(gensym))) names) ,@body))
I think it's a little more efficient as gensym only gets called during the macroexpansion, not at runtime. However, being at a very early stage of learning Lisp (10 days), I'm not sure if it is dangerous to call gensym like this for some reason.Thanks in advance.