这写安慰我期望的方式:在Clojurescript中,如何将集合的元素作为参数传递给变量arity Javascript函数?
(.log js/console "hi" "there")
输出是
hi there
然而,这只是写了一个很大的混乱到控制台:
(defn log-it [& args] (.log js/console args))
(log-it "hello" "there")
的输出为:
c…s.c…e.IndexedSeq {arr: Array[2], i: 0, meta: null, cljs$lang$protocol_mask$partition0$: 166592766, cljs$lang$protocol_mask$partition1$: 8192}
这也不起作用:
(apply .log js/console ["hi" "there"])
是有办法的矢量的元素传递到.LOG功能? 我是否必须编写一个宏来将该向量连接到'(.log js/console)
?
什么版本的clojurescript。我用clojurescript 1.9运行planck 1.17,你的'log-it'函数似乎工作正常。 –