我面對一個超級古怪的問題,今天與clojure和clojurescript中的「take」的區別?
(let [t :cognitive
tab (name t)
tab-name (string/join "" (take 3 (string/split tab #"")))]
(println "@@@" t tab tab-name))
回報
@@@ :cognitive cognitive cog
用Clojure
,但
@@@ :cognitive cognitive co
在clojurescript
(使用試劑渲染)。注意到在cljs版本
我曾嘗試doall
之前和之後的(take 3 ...
表達,但無濟於事
BTW失蹤g
,我使用
[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.7.170"]
我cljs項目和
[org.clojure/clojure "1.8.0"]
爲CLJ項目
我猜你還有一些其他的原因,你使用字符串/字符串拆分,但只是想我會提到字符串被強制序列。所以你可以在你的例子中使用'(take 3 tab)'。 –
嘿@NathanDavis,我沒有想到這一點。感謝您指出:) –