说我已经定义为CL-WHO宏:Common Lisp:如何使用宏为CL-WHO生成S表达式?
(defmacro test-html (&body body)
`(with-html-output-to-string (*standard-output* nil :PROLOGUE t :indent t)
(:html
(:body
,@body))))
然后:
(test-html (:h1 "hallo"))
给出(已删除第一行):
"<html>
<body>
<h1>
hallo
</h1>
</body>
</html>"
正如所预期的。现在我已经定义了一个函数生成S-表达由CL-WHO使用:
(defun test-header (txt)
`(:h1 ,txt))
当所谓的“你好”返回
(:h1 "hallo")
但现在当我打电话
(test-html (test-header "hallo"))
它返回:
"<html>
<body>
</body>
</html>"
出了什么问题,为什么?
感谢您的链接!这很有趣......在阅读整篇文章并进入评论部分后,我意识到2个月前我阅读了这篇文章并留下了评论。我的记忆让我失望 - 我会尝试Vsevolod的叉子! – mck 2012-04-12 13:50:56