我不明白如何獲得完整的宏觀擴展。爲什麼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
不能在嵌套結構的工作。我對嗎 ?