function | since v0.0-927 | clojure.set/union | Edit |
(union)
(union s1)
(union s1 s2)
(union s1 s2 & sets)
Return a set that is the union of the input sets.
Return a set that is the union of the input sets
(defn union
([] #{})
([s1] s1)
([s1 s2]
(if (< (count s1) (count s2))
(reduce conj s2 s1)
(reduce conj s1 s2)))
([s1 s2 & sets]
(let [bubbled-sets (bubble-max-key count (conj sets s2 s1))]
(reduce into (first bubbled-sets) (rest bubbled-sets)))))