Liking cljdoc? Tell your friends :D

org.replikativ.persistent-sorted-set

clj

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.
cljs

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.
raw docstring

compactclj/s≠

(compact set)
clj

Rebuild the tree with optimal fill factors from the current elements. Useful after heavy insert/delete churn that may have degraded node fill ratios. Preserves comparator, settings, and metadata. Returns a new set with the same elements in a freshly built tree.

Note: currently materializes all elements in memory. For large IStorage-backed sets, ensure sufficient heap space.

Rebuild the tree with optimal fill factors from the current elements.
Useful after heavy insert/delete churn that may have degraded node
fill ratios. Preserves comparator, settings, and metadata.
Returns a new set with the same elements in a freshly built tree.

Note: currently materializes all elements in memory. For large
IStorage-backed sets, ensure sufficient heap space.
cljs

Rebuild the tree with optimal fill factors from the current elements. Useful after heavy insert/delete churn that may have degraded node fill ratios. Preserves comparator, settings, and metadata. Returns a new set with the same elements in a freshly built tree.

Note: currently materializes all elements in memory.

Rebuild the tree with optimal fill factors from the current elements.
Useful after heavy insert/delete churn that may have degraded node
fill ratios. Preserves comparator, settings, and metadata.
Returns a new set with the same elements in a freshly built tree.

Note: currently materializes all elements in memory.
source (clj)source (cljs)raw docstring

conjclj/s≠

clj
(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.
cljs
(conj set key)
(conj set key arg)
(conj set key cmp opts)

Analogue to [[clojure.core/conj]] but with comparator that overrides the one stored in set. returns BTSet by default returns continuation yeilding BTSet when {:sync? false}

Analogue to [[clojure.core/conj]] but with comparator that overrides the one stored in set.
returns BTSet by default
returns continuation yeilding BTSet when {:sync? false}
source (clj)source (cljs)raw docstring

contains?cljs

(contains? set key)
(contains? set key opts)

returns boolean by default returns continuation yeilding boolean when {:sync? false}

returns boolean by default
returns continuation yeilding boolean when {:sync? false}
sourceraw docstring

countcljs

(count set)
(count set opts)

O(n) when restoring root address, otherwise O(1) returns number by default returns continuation yeilding number when {:sync? false}

O(n) when restoring root address, otherwise O(1)
returns number by default
returns continuation yeilding number when {:sync? false}
sourceraw docstring

count-sliceclj/s≠

clj
(count-slice set from to)
(count-slice set from to cmp)

Count elements in the range [from, to] inclusive. Uses O(log n) algorithm when subtree counts are available. If from is nil, counts from the beginning. If to is nil, counts to the end. Optionally pass in comparator that will override the one that set uses.

Count elements in the range [from, to] inclusive.
Uses O(log n) algorithm when subtree counts are available.
If from is nil, counts from the beginning.
If to is nil, counts to the end.
Optionally pass in comparator that will override the one that set uses.
cljs
(count-slice set from to)
(count-slice set from to arg)
(count-slice set from to cmp opts)

Count elements in the range [from, to] inclusive. Uses O(log n) algorithm when subtree counts are available. If from is nil, counts from the beginning. If to is nil, counts to the end. Optionally pass in comparator that will override the one that set uses. Returns number by default. Returns continuation yielding number when {:sync? false}.

Count elements in the range [from, to] inclusive.
Uses O(log n) algorithm when subtree counts are available.
If from is nil, counts from the beginning.
If to is nil, counts to the end.
Optionally pass in comparator that will override the one that set uses.
Returns number by default.
Returns continuation yielding number when {:sync? false}.
source (clj)source (cljs)raw docstring

disjclj/s≠

clj
(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.
cljs
(disj set key)
(disj set key arg)
(disj set key cmp opts)

Analogue to [[clojure.core/disj]] with comparator that overrides the one stored in set. returns BTSet by default returns continuation yeilding BTSet when {:sync? false}

Analogue to [[clojure.core/disj]] with comparator that overrides the one stored in set.
returns BTSet by default
returns continuation yeilding BTSet when {:sync? false}
source (clj)source (cljs)raw docstring

equiv-sequential?cljs

(equiv-sequential? set other)
(equiv-sequential? set other opts)

Test items in sequential order. returns boolean by default returns continuation yeilding boolean when {:sync? false}

Test items in sequential order.
returns boolean by default
returns continuation yeilding boolean when {:sync? false}
sourceraw docstring

equiv?cljs

(equiv? set other)
(equiv? set other opts)

Is other a set with the same items? returns boolean by default returns continuation yeilding boolean when {:sync? false}

Is _other_ a set with the same items?
returns boolean by default
returns continuation yeilding boolean when {:sync? false}
sourceraw docstring

from-sequentialclj/s≠

clj
(from-sequential cmp keys)
(from-sequential cmp keys opts)

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]].
cljs
(from-sequential cmp seq)
(from-sequential cmp seq opts)

Create a set with custom comparator and a collection of keys. Useful when you'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't want to call [[clojure.core/apply]] on [[sorted-set-by]].
source (clj)source (cljs)raw docstring

from-sorted-arrayclj/s≠

clj
(from-sorted-array cmp keys)
(from-sorted-array cmp keys len)
(from-sorted-array cmp keys len opts)
cljs
(from-sorted-array cmp arr)
(from-sorted-array cmp arr _len)
(from-sorted-array cmp arr _len opts)

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.
source (clj)source (cljs)raw docstring

get-nthclj/s≠

clj
(get-nth set n)

Find the entry at weighted rank n. Navigation uses cached subtree measure and IMeasure.weight() for O(log entries) performance.

Returns [entry local-offset] where local-offset is the rank within the found entry, or nil if out of bounds.

Requires measure with weight() to be configured on the set.

Find the entry at weighted rank `n`.
Navigation uses cached subtree measure and IMeasure.weight() for
O(log entries) performance.

Returns `[entry local-offset]` where `local-offset` is the rank
within the found entry, or nil if out of bounds.

Requires measure with weight() to be configured on the set.
cljs
(get-nth set n)
(get-nth set n opts)

Find the entry at weighted rank n. Navigation uses cached subtree measure and IMeasure weight for O(log entries) performance.

Returns [entry local-offset] where local-offset is the rank within the found entry, or nil if out of bounds.

Requires measure with weight to be configured on the set. Returns continuation yielding result when {:sync? false}.

Find the entry at weighted rank `n`.
Navigation uses cached subtree measure and IMeasure weight for
O(log entries) performance.

Returns [entry local-offset] where local-offset is the rank
within the found entry, or nil if out of bounds.

Requires measure with weight to be configured on the set.
Returns continuation yielding result when {:sync? false}.
source (clj)source (cljs)raw docstring

intocljs

(into set arg)
(into set arg0 arg1)
(into set xform from opts)

xforms must be synchronous returns collection by default returns continuation yielding collection when {:sync? false}

xforms must be synchronous
returns collection by default
returns continuation yielding collection when {:sync? false}
sourceraw docstring

lookupclj/s≠

(lookup set key)
(lookup set key cmp)
clj

Look up a key and return the actual stored element. Unlike get/valAt which return the search key, this returns the stored element - useful when using custom comparators that only compare part of the key (e.g., [id value] tuples compared by id).

O(log n) traversal with no allocations (unlike slice).

Returns nil if not found.

Look up a key and return the actual stored element.
Unlike get/valAt which return the search key, this returns the
stored element - useful when using custom comparators that only
compare part of the key (e.g., [id value] tuples compared by id).

O(log n) traversal with no allocations (unlike slice).

Returns nil if not found.
cljs

Look up key in the set. Returns key if present, else nil. 3-arity version accepts a custom comparator.

Look up key in the set. Returns key if present, else nil.
3-arity version accepts a custom comparator.
source (clj)source (cljs)raw docstring

measureclj/s≠

clj
(measure set)

Get the aggregated measure for the entire set. Returns the measure object computed by the measure-ops provided when creating the set. Returns nil if no measure-ops were provided.

Get the aggregated measure for the entire set.
Returns the measure object computed by the measure-ops provided when creating the set.
Returns nil if no measure-ops were provided.
cljs
(measure set)
(measure set opts)

Get the aggregated measure for the entire set. Returns the measure object computed by the measure-ops provided when creating the set. Returns nil if no measure-ops were provided or the set is empty. Returns continuation yielding measure when {:sync? false}.

Get the aggregated measure for the entire set.
Returns the measure object computed by the measure-ops provided when creating the set.
Returns nil if no measure-ops were provided or the set is empty.
Returns continuation yielding measure when {:sync? false}.
source (clj)source (cljs)raw docstring

measure-sliceclj/s≠

clj
(measure-slice set from to)

Compute measure for elements in the range [from, to] inclusive. Uses O(log n + k) algorithm where k is keys in boundary leaves. If from is nil, computes from the beginning. If to is nil, computes to the end. Returns nil if no measure-ops configured.

Compute measure for elements in the range [from, to] inclusive.
Uses O(log n + k) algorithm where k is keys in boundary leaves.
If from is nil, computes from the beginning.
If to is nil, computes to the end.
Returns nil if no measure-ops configured.
cljs
(measure-slice set from to)
(measure-slice set from to cmp)
(measure-slice set from to cmp opts)

Compute measure for elements in the range [from, to] inclusive. Uses O(log n + k) algorithm where k is keys in boundary leaves. If from is nil, computes from the beginning. If to is nil, computes to the end. Returns nil if no measure-ops configured. Returns continuation yielding measure when {:sync? false}.

Compute measure for elements in the range [from, to] inclusive.
Uses O(log n + k) algorithm where k is keys in boundary leaves.
If from is nil, computes from the beginning.
If to is nil, computes to the end.
Returns nil if no measure-ops configured.
Returns continuation yielding measure when {:sync? false}.
source (clj)source (cljs)raw docstring

reducecljs

(reduce arf set from)
(reduce arf set from opts)

reducing function is fn<acc,item> and must return a continuation returns result by default returns continuation yielding result when {:sync? false}

reducing function is fn<acc,item> and _must_ return a continuation
returns result by default
returns continuation yielding result when {:sync? false}
sourceraw docstring

replaceclj/s≠

clj
(replace set old-key new-key)
(replace set old-key new-key cmp)

Replace an existing key with a new key at the same logical position. The comparator must return 0 for both old-key and new-key. This is a single-traversal update - much faster than disj + conj.

O(log n) traversal with minimal allocations.

Returns the updated set, or the original set if old-key not found.

Replace an existing key with a new key at the same logical position.
The comparator must return 0 for both old-key and new-key.
This is a single-traversal update - much faster than disj + conj.

O(log n) traversal with minimal allocations.

Returns the updated set, or the original set if old-key not found.
cljs
(replace set old-key new-key)
(replace set old-key new-key arg)
(replace set old-key new-key cmp opts)

Replace an existing key with a new key at the same logical position. The comparator must return 0 for both old-key and new-key. This is a single-traversal update - faster than disj + conj. returns BTSet by default returns continuation yielding BTSet when {:sync? false}

Replace an existing key with a new key at the same logical position.
The comparator must return 0 for both old-key and new-key.
This is a single-traversal update - faster than disj + conj.
returns BTSet by default
returns continuation yielding BTSet when {:sync? false}
source (clj)source (cljs)raw docstring

restoreclj/s≠

clj
(restore address storage)
(restore address storage opts)

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
cljs
(restore root-address-or-info storage)
(restore root-address-or-info storage opts)

Restore a set from storage given root-address-or-info and storage. This operation is always synchronous and does not initiate io.

  • First arg can be either:
    • A root address (UUID) - requires opts with :shift and :count
    • A map from store-set with :root-address :comparator

returns BTSet, always synchronously

Restore a set from storage given root-address-or-info and storage.
This operation is always synchronous and does not initiate io.
+ First arg can be either:
  - A root address (UUID) - requires opts with :shift and :count
  - A map from store-set with :root-address :comparator

returns BTSet, **always synchronously**
source (clj)source (cljs)raw docstring

restore-byclj

(restore-by cmp address storage)
(restore-by cmp address storage opts)

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
sourceraw docstring

rseqcljs

(rseq set)
(rseq set opts)

returns btset/ReverseIter by default returns continuation yielding btset/AsyncRSeq when {:sync? false}

returns btset/ReverseIter by default
returns continuation yielding btset/AsyncRSeq when {:sync? false}
sourceraw docstring

rsliceclj/s≠

clj
(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]].
cljs
(rslice set key)
(rslice set key-from key-to)
(rslice set key-from key-to arg)
(rslice set key-from key-to cmp opts)

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]].
source (clj)source (cljs)raw docstring

seekclj/s≠

clj
(seek seq to)
(seek seq to cmp)
cljs
(seek seq to)
(seek seq to arg)
(seek seq to cmp opts)

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.
source (clj)source (cljs)raw docstring

seqcljs

(seq set)
(seq set opts)

returns btset/Iter by default returns continuation yielding btset/AsyncSeq when {:sync? false}

returns btset/Iter by default
returns continuation yielding btset/AsyncSeq when {:sync? false}
sourceraw docstring

settingsclj

(settings set)
source

sliceclj/s≠

clj
(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]].
cljs
(slice set key-from key-to)
(slice set key-from key-to arg)
(slice set key-from key-to comparator opts)

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]].
source (clj)source (cljs)raw docstring

sorted-setclj/s≠

(sorted-set)
(sorted-set & keys)
clj

Create a set with default comparator.

Create a set with default comparator.
source (clj)source (cljs)raw docstring

sorted-set*clj/s≠

(sorted-set* opts)
clj

Create a set with custom comparator, metadata and settings. Options: :comparator Custom comparator (defaults to compare) :storage IStorage implementation :measure IMeasure implementation for aggregate measures :meta Metadata map :branching-factor B-tree branching factor (default 512) :ref-type Reference type for cached nodes (:strong, :soft, :weak)

Create a set with custom comparator, metadata and settings.
Options:
  :comparator  Custom comparator (defaults to compare)
  :storage     IStorage implementation
  :measure     IMeasure implementation for aggregate measures
  :meta        Metadata map
  :branching-factor  B-tree branching factor (default 512)
  :ref-type    Reference type for cached nodes (:strong, :soft, :weak)
cljs

Create a set with options map containing:

  • :storage Storage implementation
  • :comparator Custom comparator (defaults to compare)
  • :meta Metadata
Create a set with options map containing:
- :storage  Storage implementation
- :comparator  Custom comparator (defaults to compare)
- :meta     Metadata
source (clj)source (cljs)raw docstring

sorted-set-byclj/s≠

(sorted-set-by cmp)
(sorted-set-by cmp & keys)
clj

Create a set with custom comparator.

Create a set with custom comparator.
source (clj)source (cljs)raw docstring

storeclj/s≠

clj
(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
cljs
(store set)
(store set arg)
(store set storage opts)

Flush set to storage. sync calls must be used with sync storage and async calls must be used with async storage.

returns address by default returns continuation yeilding address when {:sync? false}

Flush set to storage. sync calls must be used with sync storage
and async calls must be used with async storage.

returns address by default
returns continuation yeilding address when {:sync? false}
source (clj)source (cljs)raw docstring

transducecljs

(transduce xform arf set from)
(transduce xform arf set from opts)

xforms must be synchronous reducing function is fn<acc,item> and must return a continuation returns result by default returns continuation yielding result when {:sync? false}

xforms must be synchronous
reducing function is fn<acc,item> and _must_ return a continuation
returns result by default
returns continuation yielding result when {:sync? false}
sourceraw docstring

walk-addressesclj/s≠

clj
(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
cljs
(walk-addresses set consume-fn)
(walk-addresses set consume-fn opts)

Visit each address used by this set. Usable for cleaning up garbage left in storage from previous versions of the set.

returns nil when the walk completes returns a continuation yielding nil when {:sync? false}

Visit each address used by this set. Usable for cleaning up
garbage left in storage from previous versions of the set.

returns nil when the walk completes
returns a continuation yielding nil when {:sync? false}
source (clj)source (cljs)raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close