A B-tree based persistent sorted set. Supports transients, custom comparators, fast iteration, efficient slices (iterator over a part of the set) and reverse slices. Almost a drop-in replacement for [[clojure.core/sorted-set]], the only difference being this one can’t store nil.
A B-tree based persistent sorted set. Supports transients, custom comparators, fast iteration, efficient slices (iterator over a part of the set) and reverse slices. Almost a drop-in replacement for [[clojure.core/sorted-set]], the only difference being this one can’t store nil.
(conj set key cmp)
Analogue to [[clojure.core/conj]] but with comparator that overrides the one stored in set.
Analogue to [[clojure.core/conj]] but with comparator that overrides the one stored in set.
Analogue to [[clojure.core/conj]] with comparator that overrides the one stored in set.
Analogue to [[clojure.core/conj]] with comparator that overrides the one stored in set.
(disj set key cmp)
Analogue to [[clojure.core/disj]] with comparator that overrides the one stored in set.
Analogue to [[clojure.core/disj]] with comparator that overrides the one stored in set.
(from-sequential cmp keys)
(from-sequential cmp seq)
Create a set with custom comparator and a collection of keys. Useful when you don’t want to call [[clojure.core/apply]] on sorted-set-by
.
Create a set with custom comparator and a collection of keys. Useful when you don’t want to call [[clojure.core/apply]] on [[sorted-set-by]].
(from-sorted-array cmp keys)
(from-sorted-array cmp keys len)
(from-sorted-array cmp arr)
Fast path to create a set if you already have a sorted array of elements on your hands.
Fast path to create a set if you already have a sorted array of elements on your hands.
(node-conj _ cmp key)
(node-disj _ cmp key root? left right)
(node-len _)
(node-lim-key _)
(node-lookup _ cmp key)
(node-merge _ next)
(node-merge-n-split _ next)
(restore address storage)
Constructs lazily-loaded set from storage and root address. Supports all operations that normal in-memory impl would, will fetch missing nodes by calling IStorage::restore when needed
Constructs lazily-loaded set from storage and root address. Supports all operations that normal in-memory impl would, will fetch missing nodes by calling IStorage::restore when needed
(restore-by cmp address storage)
Constructs lazily-loaded set from storage, root address and custom comparator. Supports all operations that normal in-memory impl would, will fetch missing nodes by calling IStorage::restore when needed
Constructs lazily-loaded set from storage, root address and custom comparator. Supports all operations that normal in-memory impl would, will fetch missing nodes by calling IStorage::restore when needed
(rslice set from to)
(rslice set from to cmp)
A reverse iterator for part of the set with provided boundaries.
(rslice set from to)
returns backwards iterator for all Xs where from <= X <= to.
(rslice set from nil)
returns backwards iterator for all Xs where X <= from.
Optionally pass in comparator that will override the one that set uses. Supports efficient [[clojure.core/rseq]].
A reverse iterator for part of the set with provided boundaries. `(rslice set from to)` returns backwards iterator for all Xs where from <= X <= to. `(rslice set from nil)` returns backwards iterator for all Xs where X <= from. Optionally pass in comparator that will override the one that set uses. Supports efficient [[clojure.core/rseq]].
(rslice set key)
(rslice set key-from key-to)
(rslice set key-from key-to comparator)
A reverse iterator for part of the set with provided boundaries.
(rslice set from to)
returns backwards iterator for all Xs where from <= X <= to.
Optionally pass in comparator that will override the one that set uses. Supports efficient [[clojure.core/rseq]].
A reverse iterator for part of the set with provided boundaries. `(rslice set from to)` returns backwards iterator for all Xs where from <= X <= to. Optionally pass in comparator that will override the one that set uses. Supports efficient [[clojure.core/rseq]].
(seek seq to)
(seek seq to cmp)
An efficient way to seek to a specific key in a seq (either returned by [[clojure.core.seq]] or a slice.)
(seek (seq set) to)
returns iterator for all Xs where to <= X.
Optionally pass in comparator that will override the one that set uses.
An efficient way to seek to a specific key in a seq (either returned by [[clojure.core.seq]] or a slice.) `(seek (seq set) to)` returns iterator for all Xs where to <= X. Optionally pass in comparator that will override the one that set uses.
(set-branching-factor! n)
Global -- applies to all sets. Must be power of 2. Defaults to 64
Global -- applies to all sets. Must be power of 2. Defaults to 64
(slice set from to)
(slice set from to cmp)
An iterator for part of the set with provided boundaries.
(slice set from to)
returns iterator for all Xs where from <= X <= to.
(slice set from nil)
returns iterator for all Xs where X >= from.
Optionally pass in comparator that will override the one that set uses. Supports efficient [[clojure.core/rseq]].
An iterator for part of the set with provided boundaries. `(slice set from to)` returns iterator for all Xs where from <= X <= to. `(slice set from nil)` returns iterator for all Xs where X >= from. Optionally pass in comparator that will override the one that set uses. Supports efficient [[clojure.core/rseq]].
(slice set key-from key-to)
(slice set key-from key-to comparator)
An iterator for part of the set with provided boundaries.
(slice set from to)
returns iterator for all Xs where from <= X <= to.
Optionally pass in comparator that will override the one that set uses. Supports efficient [[clojure.core/rseq]].
An iterator for part of the set with provided boundaries. `(slice set from to)` returns iterator for all Xs where from <= X <= to. Optionally pass in comparator that will override the one that set uses. Supports efficient [[clojure.core/rseq]].
(sorted-set)
(sorted-set & keys)
Create a set with default comparator.
Create a set with default comparator.
(sorted-set-by cmp)
(sorted-set-by cmp & keys)
Create a set with custom comparator.
Create a set with custom comparator.
(store set)
(store set storage)
Store each not-yet-stored node by calling IStorage::store and remembering returned address. Incremental, won’t store same node twice on subsequent calls. Returns root address. Remember it and use it for restore
Store each not-yet-stored node by calling IStorage::store and remembering returned address. Incremental, won’t store same node twice on subsequent calls. Returns root address. Remember it and use it for restore
(walk-addresses set consume-fn)
Visit each address used by this set. Usable for cleaning up garbage left in storage from previous versions of the set
Visit each address used by this set. Usable for cleaning up garbage left in storage from previous versions of the set
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close