PersistentTreeSet
(PersistentTreeSet. meta tree-map __hash)
(deftype PersistentTreeSet [meta tree-map ^:mutable __hash]
Object
(toString [coll]
(pr-str* coll))
(equiv [this other]
(-equiv this other))
(keys [coll]
(es6-iterator (seq coll)))
(entries [coll]
(es6-set-entries-iterator (seq coll)))
(values [coll]
(es6-iterator (seq coll)))
(has [coll k]
(contains? coll k))
(forEach [coll f]
(doseq [[k v] coll]
(f v k)))
ICloneable
(-clone [_] (PersistentTreeSet. meta tree-map __hash))
IWithMeta
(-with-meta [coll new-meta]
(if (identical? new-meta meta)
coll
(PersistentTreeSet. new-meta tree-map __hash)))
IMeta
(-meta [coll] meta)
ICollection
(-conj [coll o]
(PersistentTreeSet. meta (assoc tree-map o nil) nil))
IEmptyableCollection
(-empty [coll] (PersistentTreeSet. meta (-empty tree-map) 0))
IEquiv
(-equiv [coll other]
(and
(set? other)
(== (count coll) (count other))
^boolean
(try
(reduce-kv
#(or (contains? other %2) (reduced false))
true tree-map)
(catch js/Error ex
false))))
IHash
(-hash [coll] (caching-hash coll hash-unordered-coll __hash))
ISeqable
(-seq [coll] (keys tree-map))
ISorted
(-sorted-seq [coll ascending?]
(map key (-sorted-seq tree-map ascending?)))
(-sorted-seq-from [coll k ascending?]
(map key (-sorted-seq-from tree-map k ascending?)))
(-entry-key [coll entry] entry)
(-comparator [coll] (-comparator tree-map))
IReversible
(-rseq [coll]
(if (pos? (count tree-map))
(map key (rseq tree-map))))
ICounted
(-count [coll] (count tree-map))
ILookup
(-lookup [coll v]
(-lookup coll v nil))
(-lookup [coll v not-found]
(let [n (.entry-at tree-map v)]
(if-not (nil? n)
(.-key n)
not-found)))
ISet
(-disjoin [coll v]
(PersistentTreeSet. meta (dissoc tree-map v) nil))
IFn
(-invoke [coll k]
(-lookup coll k))
(-invoke [coll k not-found]
(-lookup coll k not-found)))