【发布时间】:2015-03-26 18:19:37
【问题描述】:
假设我有一个像
这样的宏(defmacro repeat (times &body body)
(let ((x (gensym)))
`(dotimes (,x ,times)
,@body)))
然后我可以在repl上运行
CL-USER> (repeat 2 (print "Hi"))
"Hi"
"Hi"
NIL
如果我跑了
CL-USER> (list 'print "Hi")
(PRINT "Hi")
那为什么我不能运行
CL-USER> (repeat 2 (list 'print "hi"))
NIL
反引号只是给了我一个列表,不是吗?这与我不使用反引号(s 表达式列表)时传递给 body 参数的内容不同吗?
【问题讨论】:
标签: macros common-lisp quote