如何评估传递给ps
Parenscript 中宏的代码?
(let ((x 1))
(format nil "~a" (parenscript:ps x)))
;; => "x;" but I would like "1;"
我知道这ps
是一个宏,是不评估的原因,但是如何评估代码以传递给ps
宏?
如何评估传递给ps
Parenscript 中宏的代码?
(let ((x 1))
(format nil "~a" (parenscript:ps x)))
;; => "x;" but I would like "1;"
我知道这ps
是一个宏,是不评估的原因,但是如何评估代码以传递给ps
宏?
您的示例使用ps:lisp
:
(let ((x 1))
(format nil "~a" (ps:ps (ps:lisp x))))
"1;"
它在文档的第一部分介绍:https ://common-lisp.net/project/parenscript/reference.html#section-ps-compiler
我知道了:
(defmacro lisp-to-js (lisp)
(eval ``(parenscript:ps ,,lisp)))
(let ((x 1))
(format nil "~a" (lisp-to-js x)))
;; => "1;"