clojure.set/difference

functionsince v0.0-927 clojure.set/differenceEdit
(difference s1)
(difference s1 s2)
(difference s1 s2 & sets)

Details:

Return a set that is the first set without elements of the remaining sets.


See Also:


Source docstring:
Return a set that is the first set without elements of the remaining sets
Source code @ clojurescript:src/main/cljs/clojure/set.cljs
(defn difference
  ([s1] s1)
  ([s1 s2] 
     (if (< (count s1) (count s2))
       (reduce (fn [result item] 
                   (if (contains? s2 item) 
                     (disj result item) 
                     result))
               s1 s1)
       (reduce disj s1 s2)))
  ([s1 s2 & sets] 
     (reduce difference s1 (conj sets s2))))