rope) — persistent chunked sequence for O(log n) structural editing
(concat, split, splice, insert, remove). Backed by a weight-balanced tree of
chunk vectors with a formal Chunk Size Invariant. Up to 1968x faster than
PersistentVector on repeated random edits at 500K elements; 3-10x faster
on concatenation; 1.3-1.7x faster on reduce at scale. Includes
structure-sharing subrange views via rope-sub, transient support for batch construction,
parallel r/fold, java.util.List interop, and lexicographic Comparable.range-map) — non-overlapping [lo, hi) ranges with automatic carve-out on insertsegment-tree, sum-tree, min-tree, max-tree) — O(log n) range aggregation with any associative operationpriority-queue) — O(log n) push/peek/pop with min and max accessordered-multiset) — sorted bag allowing duplicate elementsfuzzy-set, fuzzy-map) — nearest-neighbor lookup by distance with configurable tiebreakingunion, intersection, difference, subset?, superset?, disjoint?rank, slice, median, percentilenearest (floor/ceiling with keyword tests :<=, :>=, :<, :>), subrange, split-key, split-atoverlapping, spanranges, span, gaps, assoc-coalescing, get-entry, range-removequery, aggregate, update-val, update-fnpush, push-all, peek-min, peek-min-val, pop-min, peek-max, peek-max-val, pop-maxmultiplicity, disj-one, disj-all, distinct-elements, element-frequenciesfuzzy-nearest, fuzzy-exact-contains?, fuzzy-exact-getrope-concat, rope-concat-all, rope-split, rope-sub, rope-insert, rope-remove, rope-splice, rope-chunks, rope-chunks-reverse, rope-chunk-count, rope-strassoc-new, ordered-merge-withgeneral-compare — opt-in total order over all values including non-Comparable types (Namespace, Var, etc.). ~20% slower lookups on Comparable types vs default.ropelong-ordered-set, long-ordered-map, double-ordered-set, double-ordered-map, string-ordered-set, string-ordered-mapordered-set-by, ordered-map-by, ordered-set-with, ordered-map-with, ordered-multiset-by, fuzzy-set-by, fuzzy-map-by, segment-tree-by, segment-tree-withlong-compare, double-compare, string-compare, general-compare, compare-byclojure.lang.Sorted — native subseq/rsubseq on ordered-set and ordered-mapclojure.core.reducers/CollFold — chunked parallel fold; ordered-set/map, rope, and compatible tree-backed types split into larger chunks before delegating to r/foldclojure.lang.IEditableCollection / ITransientCollection — transient support for Rope with mutable tail buffer for efficient batch constructionclojure.core.protocols/CollReduce — implemented directly on all collection deftypes for correct fast-path reductionclojure.lang.IHashEq — correct hash for use in hash-based collectionsjava.io.Serializable — Java serialization supportIReduceInit/IReduce — direct tree traversal for fast reduceISeq implementations (KeySeq, EntrySeq) replace lazy-seq wrappersRound-trip serialization via data_readers.clj: #ordered/set, #ordered/map, #ordered/interval-set, #ordered/interval-map, #ordered/range-map, #ordered/priority-queue, #ordered/multiset, #ordered/rope. Collections with custom comparators (including general-compare) print in opaque #<Type ...> form to avoid non-round-trippable tagged literals.
65,536–131,072), 65,536 recursive thresholds, and 64 sequential cutoffLongKeyNode, DoubleKeyNode) — unboxed key storagelong-ordered-set bypasses Comparator dispatchintersects? reduced from up to 12 comparisons to 2 (closed-interval identity: a0 <= b1 AND a1 <= b0)reduced short-circuiting.ordered-set fold against hash-set reduce, sorted-set fold/reduce, and data.avl fold/reducetest-utils and bench-utilsSee benchmarks for current numbers and analysis.
ordered-collections.* / ordered_collections.* rather than com.dean.ordered-collections.*src/ordered_collections and test/ordered_collectionslein stats — babashka-based project statistics report (clj-kondo analysis, git churn, codebase metrics)SortedSet.tailSet now returns elements >= x (was exclusive)SortedSet.subSet now returns elements >= from, < tosegment-tree range queries are generic over ordered keys rather than assuming integer-only query boundsgeneral-compare collections print opaque (#<OrderedSet ...>) rather than emitting tagged literals that cannot round-trip through EDNmap wrappers; stronger coverage for duplicate-priority ordering and boundary casesoc/rank not oc/rank-of)doc/benchmarks.md; the older perf-analysis.md and when-to-use.md are removeddoc/api output is no longer tracked in the repositorymutable-ordered-set, mutable-ordered-map, mutable-interval-set, mutable-interval-maptransient/persistent! support (path-copying made it a no-op)rank-of → rank (returns nil instead of -1 for missing elements)ordered-collectionsordered-set, ordered-map, interval-set, interval-mapnth and indexOf in O(log n) timeCan you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |