This namespace provides a total-ordering comparator for Clojure values.
This namespace provides a total-ordering comparator for Clojure values.
(compare-seqs order xs ys)
Compare sequences using the given comparator. If any element of the sequences orders differently, it determines the ordering. Otherwise, if the prefix matches, the longer sequence sorts later.
Compare sequences using the given comparator. If any element of the sequences orders differently, it determines the ordering. Otherwise, if the prefix matches, the longer sequence sorts later.
(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.
(type-name x)
Get the type of the given object as a string. For Clojure, gets the name of
the class of the object. For ClojureScript, gets either the name
attribute
or the protocol name if the name
attribute doesn't exist.
Get the type of the given object as a string. For Clojure, gets the name of the class of the object. For ClojureScript, gets either the `name` attribute or the protocol name if the `name` attribute doesn't exist.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close