问题
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