为什么这两个表达式给出相同的结果?
> (macroexpand-all '(->> "string"(.charAt)))
(."string"charAt)
> (macroexpand-all '(-> "string"(.charAt)))
(."string"charAt)
“->>”宏不是应该插入“string”作为列表中的最后一个元素吗?
最佳答案
它首先扩展为 (.charAt "string")
,这确实是最后一个。然后该形式进一步扩展为 (."string"charAt)
。
关于clojure - 线程优先、线程最后和 "dot"形式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13204636/