set

functionsince v0.0-927 clojure.core/setEdit
(set coll)

Details:

Returns a set of the distinct elements of coll.


See Also:


Source docstring:
Returns a set of the distinct elements of coll.
Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(defn set
  [coll]
  (if (set? coll)
    (with-meta coll nil)
    (let [in (seq coll)]
      (cond
        (nil? in) #{}

        (and (instance? IndexedSeq in) (zero? (.-i in)))
        (.createAsIfByAssoc PersistentHashSet (.-arr in))

        :else
        (loop [^not-native in  in
               ^not-native out (-as-transient #{})]
          (if-not (nil? in)
            (recur (next in) (-conj! out (-first in)))
            (persistent! out)))))))