(compare-by pred)Given a predicate that defines a total order over some domain, return a three-way Comparator built from it. Note: The predicate must be serializable for the comparator to be serializable.
Given a predicate that defines a total order over some domain, return a three-way Comparator built from it. Note: The predicate must be serializable for the comparator to be serializable.
(default-comparator? cmp)Returns true if cmp is one of the built-in comparators whose ordering is equivalent to clojure.core/compare for its element type. Used to determine if a collection can safely round-trip through EDN.
Returns true if cmp is one of the built-in comparators whose ordering is equivalent to clojure.core/compare for its element type. Used to determine if a collection can safely round-trip through EDN.
Specialized comparator for Double keys.
Specialized comparator for Double keys.
General-purpose comparator that provides a deterministic total order over all values, including types that clojure.core/compare does not order (such as Namespace and Var).
For Comparable values, delegates to clojure.core/compare. For non-Comparable values, falls back to class name, then str, then hash ordering.
Use with ordered-set-with / ordered-map-with. Expect roughly 20% slower lookups compared to the default comparator on Comparable types.
General-purpose comparator that provides a deterministic total order over all values, including types that clojure.core/compare does not order (such as Namespace and Var). For Comparable values, delegates to clojure.core/compare. For non-Comparable values, falls back to class name, then str, then hash ordering. Use with ordered-set-with / ordered-map-with. Expect roughly 20% slower lookups compared to the default comparator on Comparable types.
Specialized comparator for Long keys. Avoids type dispatch overhead of clojure.core/compare for ~15-25% faster comparisons on numeric keys.
Specialized comparator for Long keys. Avoids type dispatch overhead of clojure.core/compare for ~15-25% faster comparisons on numeric keys.
Default comparator that delegates to clojure.core/compare. For best numeric performance, use long-ordered-set/long-ordered-map.
Default comparator that delegates to clojure.core/compare. For best numeric performance, use long-ordered-set/long-ordered-map.
Specialized comparator for String keys. Uses String.compareTo directly.
Specialized comparator for String keys. Uses String.compareTo directly.
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 |