ale*_*y2k 3 macros clojure clojure-java-interop
为什么这两个表达式都给出相同的结果?
> (macroexpand-all '(->> "string" (.charAt)))
(. "string" charAt)
> (macroexpand-all '(-> "string" (.charAt)))
难道不应该将“->>”宏插入“ string”作为列表中的最后一个元素吗?
ama*_*loy 5
它首先扩展到(.charAt "string"),这实际上是最后一个。然后该形式进一步扩展为(. "string" charAt)。
(.charAt "string")
归档时间:
12 年,11 月 前
查看次数:
193 次
最近记录: