ClojureScript clojure.set?

笑着哭i 提交于 2019-12-10 02:50:10

问题


How can I use clojure.set in ClojureScript?

I always get a error.

(def middle-land (set (for [x water-hor
                            y (vec (clojure.set/difference (set (range 0 board-side))
                                                           (set water-ver)))]
                    [x y])))

ReferenceError: clojure is not defined

回答1:


Seems you need to explicitly require the namespace to be able to use it:

ClojureScript:cljs.user> (ns core (:require clojure.set))
ClojureScript:core> (clojure.set/difference #{1 2} #{1 4}) ;=> #{2}


来源:https://stackoverflow.com/questions/21367433/clojurescript-clojure-set

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!