This namespace provides a total-ordering comparator for Clojure values.
This namespace provides a total-ordering comparator for Clojure values.
(rank a b)
Comparator function that provides a total ordering of EDN values. Values of
different types sort in order of their types, per type-priority
. false
is before true
, numbers are ordered by magnitude regardless of type, and
characters, strings, keywords, and symbols are ordered lexically.
Sequential collections are sorted by comparing their elements one at a time. If the sequences have equal leading elements, the longer one is ordered later. Sets are compared by cardinality first, then elements in sorted order. Finally, maps are compared by their entries in sorted order of their keys.
All other types are sorted by class name. If the class implements
Comparable
, the instances of it are compared using compare
. Otherwise, the
values are ordered by print representation. This has the default behavior of
ordering by hash code if the type does not implement a custom print format.
Comparator function that provides a total ordering of EDN values. Values of different types sort in order of their types, per `type-priority`. `false` is before `true`, numbers are ordered by magnitude regardless of type, and characters, strings, keywords, and symbols are ordered lexically. Sequential collections are sorted by comparing their elements one at a time. If the sequences have equal leading elements, the longer one is ordered later. Sets are compared by cardinality first, then elements in sorted order. Finally, maps are compared by their entries in sorted order of their keys. All other types are sorted by class name. If the class implements `Comparable`, the instances of it are compared using `compare`. Otherwise, the values are ordered by print representation. This has the default behavior of ordering by hash code if the type does not implement a custom print format.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close