Liking cljdoc? Tell your friends :D

ordered-collections.protocol


PExclusiveAssoccljprotocol

Protocol for exclusive association (insert only, no update).

Protocol for exclusive association (insert only, no update).

assoc-newclj

(assoc-new m k v)

Associate k with v only if k is not already present. Returns the new collection with the key added, or the original collection unchanged if the key already exists.

Associate k with v only if k is not already present.
Returns the new collection with the key added, or the original
collection unchanged if the key already exists.
sourceraw docstring

PExtensibleSetcljprotocol

Protocol for set algebra operations.

Provides the standard set-theoretic operations: union, intersection, difference, and subset/superset predicates. Operations return sets preserving the type of the receiver.

Protocol for set algebra operations.

Provides the standard set-theoretic operations: union, intersection,
difference, and subset/superset predicates. Operations return sets
preserving the type of the receiver.

differenceclj

(difference this that)

Return the set of elements in this but not in that.

Return the set of elements in this but not in that.

disjoint?clj

(disjoint? this that)

Return true if this and that share no elements.

Return true if this and that share no elements.

intersectionclj

(intersection this that)

Return the set of elements present in both this and that.

Return the set of elements present in both this and that.

subset?clj

(subset? this that)

Return true if every element of this is also in that.

Return true if every element of this is also in that.

superset?clj

(superset? this that)

Return true if every element of that is also in this.

Return true if every element of that is also in this.

unionclj

(union this that)

Return the set of elements present in either this or that.

Return the set of elements present in either this or that.
sourceraw docstring

PFuzzycljprotocol

Protocol for fuzzy/nearest-neighbor collections.

Protocol for fuzzy/nearest-neighbor collections.

exact-contains?clj

(exact-contains? coll k)

Check if collection contains exactly k (no fuzzy matching).

Check if collection contains exactly k (no fuzzy matching).

exact-getclj

(exact-get coll k)
(exact-get coll k not-found)

Get value for exactly k (maps only, no fuzzy matching).

Get value for exactly k (maps only, no fuzzy matching).

nearest-with-distanceclj

(nearest-with-distance coll query)

Find nearest element/entry with distance. Returns [element distance] for sets, [key value distance] for maps.

Find nearest element/entry with distance.
Returns [element distance] for sets, [key value distance] for maps.
sourceraw docstring

PIntervalCollectioncljprotocol

Protocol for interval-based collections supporting overlap queries.

Protocol for interval-based collections supporting overlap queries.

overlappingclj

(overlapping coll interval)

Return all intervals overlapping the given point or interval.

Return all intervals overlapping the given point or interval.
sourceraw docstring

PMultisetcljprotocol

Protocol for multiset (bag) operations.

Protocol for multiset (bag) operations.

disj-allclj

(disj-all ms k)

Remove all occurrences of k.

Remove all occurrences of k.

disj-oneclj

(disj-one ms k)

Remove one occurrence of k.

Remove one occurrence of k.

distinct-elementsclj

(distinct-elements ms)

Return set of distinct elements.

Return set of distinct elements.

element-frequenciesclj

(element-frequencies ms)

Return map of element -> count.

Return map of element -> count.

multiplicityclj

(multiplicity ms k)

Return count of element k.

Return count of element k.
sourceraw docstring

PNearestcljprotocol

Protocol for finding nearest elements and ranges relative to a key.

Protocol for finding nearest elements and ranges relative to a key.

nearestclj

(nearest coll test k)

Find the nearest element satisfying test relative to k. Tests: :< (predecessor), :<= (floor), :>= (ceiling), :> (successor). Returns element (for sets) or [key value] (for maps), or nil if none.

Find the nearest element satisfying test relative to k.
Tests: :< (predecessor), :<= (floor), :>= (ceiling), :> (successor).
Returns element (for sets) or [key value] (for maps), or nil if none.

subrangeclj

(subrange coll test k)

Return subcollection of elements satisfying test relative to k. Tests: :< :<= :>= :>

Return subcollection of elements satisfying test relative to k.
Tests: :< :<= :>= :>
sourceraw docstring

PPriorityQueuecljprotocol

Protocol for priority queue operations. Elements are [priority value] pairs. Queue order is determined by the configured priority comparator.

Protocol for priority queue operations.
Elements are [priority value] pairs. Queue order is determined by the
configured priority comparator.

peek-maxclj

(peek-max pq)

Return last [priority value] in queue order, or nil.

Return last [priority value] in queue order, or nil.

peek-max-valclj

(peek-max-val pq)

Return just the value of the last element, or nil.

Return just the value of the last element, or nil.

peek-minclj

(peek-min pq)

Return first [priority value] in queue order, or nil.

Return first [priority value] in queue order, or nil.

peek-min-valclj

(peek-min-val pq)

Return just the value of the first element, or nil.

Return just the value of the first element, or nil.

pop-maxclj

(pop-max pq)

Remove last element. Returns queue unchanged if empty.

Remove last element. Returns queue unchanged if empty.

pop-minclj

(pop-min pq)

Remove first element. Returns queue unchanged if empty.

Remove first element. Returns queue unchanged if empty.

pushclj

(push pq priority value)

Add element with given priority.

Add element with given priority.

push-allclj

(push-all pq pairs)

Add multiple [priority value] pairs.

Add multiple [priority value] pairs.
sourceraw docstring

PRangeAggregatecljprotocol

Protocol for range aggregate queries over associative operations.

Protocol for range aggregate queries over associative operations.

aggregateclj

(aggregate coll)

Return aggregate over entire collection.

Return aggregate over entire collection.

aggregate-rangeclj

(aggregate-range coll lo hi)

Return aggregate over index range [lo, hi] inclusive.

Return aggregate over index range [lo, hi] inclusive.

update-fnclj

(update-fn coll k f)

Update value at index k by applying f, returning new collection.

Update value at index k by applying f, returning new collection.

update-valclj

(update-val coll k v)

Update value at index k, returning new collection.

Update value at index k, returning new collection.
sourceraw docstring

PRangeMapcljprotocol

Protocol for range map operations (non-overlapping ranges to values).

Protocol for range map operations (non-overlapping ranges to values).

assoc-coalescingclj

(assoc-coalescing rm rng val)

Insert range [lo hi), merging adjacent same-value ranges.

Insert range [lo hi), merging adjacent same-value ranges.

gapsclj

(gaps rm)

Return seq of [lo hi] gaps between ranges.

Return seq of [lo hi] gaps between ranges.

get-entryclj

(get-entry rm point)

Return [[lo hi] value] containing point, or nil.

Return [[lo hi] value] containing point, or nil.

range-removeclj

(range-remove rm rng)

Remove all mappings in [lo, hi) range.

Remove all mappings in [lo, hi) range.

rangesclj

(ranges rm)

Return seq of [[lo hi] value] entries.

Return seq of [[lo hi] value] entries.
sourceraw docstring

PRankedcljprotocol

Protocol for collections supporting rank-based operations.

Protocol for collections supporting rank-based operations.

medianclj

(median coll)

Return the median element. For even-sized collections, returns the lower median.

Return the median element. For even-sized collections, returns the lower median.

percentileclj

(percentile coll pct)

Return the element at the given percentile (0-100).

Return the element at the given percentile (0-100).

rank-ofclj

(rank-of coll x)

Return the 0-based index of element x in sorted order, or -1 if not present.

Return the 0-based index of element x in sorted order, or -1 if not present.

sliceclj

(slice coll start end)

Return a seq of elements from index start (inclusive) to end (exclusive).

Return a seq of elements from index start (inclusive) to end (exclusive).
sourceraw docstring

PRopecljprotocol

Protocol for persistent rope operations — structural editing of indexed sequences in O(log n).

Protocol for persistent rope operations — structural editing of
indexed sequences in O(log n).

rope-catclj

(rope-cat r1 r2)

Structural rope-to-rope concatenation. O(log n).

Structural rope-to-rope concatenation. O(log n).

rope-chunksclj

(rope-chunks r)

Return a seq of the rope's internal chunk vectors.

Return a seq of the rope's internal chunk vectors.

rope-insertclj

(rope-insert r i coll)

Insert elements from coll at index i. O(log n).

Insert elements from coll at index i. O(log n).

rope-removeclj

(rope-remove r start end)

Remove range [start, end). O(log n).

Remove range [start, end). O(log n).

rope-spliceclj

(rope-splice r start end coll)

Replace range [start, end) with elements from coll. O(log n).

Replace range [start, end) with elements from coll. O(log n).

rope-splitclj

(rope-split r i)

Split rope at index i, returning [left right]. O(log n).

Split rope at index i, returning [left right]. O(log n).

rope-strclj

(rope-str r)

Efficiently convert a rope of characters/strings to a String.

Efficiently convert a rope of characters/strings to a String.

rope-subclj

(rope-sub r start end)

Extract subrange [start, end) as a new rope. O(log n).

Extract subrange [start, end) as a new rope. O(log n).
sourceraw docstring

PSpancljprotocol

Protocol for collections that cover a contiguous range.

Protocol for collections that cover a contiguous range.

spanclj

(span coll)

Return [min max] covering all elements, or nil if empty.

Return [min max] covering all elements, or nil if empty.
sourceraw docstring

PSplittablecljprotocol

Protocol for collections supporting efficient split operations. Compatible with clojure.data.avl split operations.

Protocol for collections supporting efficient split operations.
Compatible with clojure.data.avl split operations.

split-atclj

(split-at coll i)

Split collection at index i, returning [left right].

  • left: collection of the first i elements (indices 0 to i-1)
  • right: collection of remaining elements (indices i to n-1)
Split collection at index i, returning [left right].
- left: collection of the first i elements (indices 0 to i-1)
- right: collection of remaining elements (indices i to n-1)

split-keyclj

(split-key coll k)

Split collection at key k, returning [left entry right].

  • left: collection of elements less than k
  • entry: the element/entry at k, or nil if not present
  • right: collection of elements greater than k
Split collection at key k, returning [left entry right].
- left: collection of elements less than k
- entry: the element/entry at k, or nil if not present
- right: collection of elements greater than k
sourceraw 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