Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ClojureScript clojure.set?

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
like image 942
nickik Avatar asked Jan 26 '14 18:01

nickik


1 Answers

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}
like image 151
ponzao Avatar answered Nov 03 '22 07:11

ponzao