我正在尝试创建一个宏来创建一个函数,该函数采用 S 表达式并在夹具的词汇上下文中评估它们。这是我写的宏:
(defmacro def-fixture (name bindings)
"Return a function that takes the form to execute but is wrapped between a let of the bindings"
`(defun ,(intern (symbol-name name)) (body)
(let (,bindings)
(unwind-protect
(progn
body)))))
但是当我运行它时,它似乎在我提供的词汇上下文之外执行
(def-fixture test-fixture '(zxvf 1))
(test-fixture '(= zxvf 1))
let: Symbol's value as variable is void: zxvf
顺便说一句,我启用了变量词法绑定。关于我的错误有什么想法吗?