我不明白如何获得完整的宏观扩展。为什么macroexpansion不能扩展Clojure中的嵌套窗体?
有了这个代码
(when true (when true true))
我想获得完整的宏扩展
(if true (do (if true (do true)))
但我不能
我明白macroexpansion-1
将解决扩展的第一级:
(macroexpand-1 '(when true (when true true)))
(if true (do (when true true)))
但是,为什么当我再次打电话macroexpand-1
(这是应该做的macroexpand
):
(macroexpand-1 '(if true (do (when true true))))
我得到了完全相同的结果?
(if true (do (when true true)))
我期待着全面的宏观扩张。
宏扩展只适用于顶层表单吗?
我知道在clojure.walk
命名空间中的expand-all
功能的,所以我想 macroexpand
不能在嵌套结构的工作。我对吗 ?