clojure.core/set¶
Returns a set of the distinct elements of coll.
Examples¶
Note by icefox¶
The documentation doesn't mention the order, is it undefined?
{:a :b :c :d}¶
-> #{:d :a :b :c}
Note by venantius¶
Sets are a core data structure that by definition do not store elements in a sorted order. The actual order will ultimately be determined by the specific hashing function underpinning the data structure.
Note by dhbarnett¶
Is the order guaranteed to be consistent if so is it not ordered (just not asc/desc)?
Note by bfontaine¶
Sets are not ordered, so there’s not guarantee on their “order”.
See also¶
- clojure.core/hash-set (2)
- clojure.core/sorted-set (3)
- clojure.core/conj (9)
- clojure.set/join (0)
- clojure.set/select
- clojure.set/difference (0)
- clojure.set/intersection (0)
- clojure.set/union (0)
- clojure.set/index (0)
- clojure.set/project
- clojure.set/rename
- clojure.set/rename-keys (0)
- clojure.set/map-invert (0)
- clojure.core/disj (2)
- clojure.core/distinct (3)
Content from the matching ClojureDocs page, with authors credited on each contribution.