- (cc-cmp x y)
cc-cmp compares two values x and y. As a comparator, it returns a negative, 0, or positive integer if x is less than, equal to, or greater than y. cc-cmp can compare values of many types, including numbers, strings, symbols, keywords, vectors, lists, sequences, sets, maps, records, Java arrays, anything that implements the Java Comparable interface (including booleans, characters, File, URL, UUID, Clojure refs), and nil. Unlike the function compare, it sorts vectors in lexicographic order. It also sorts lists, sequences, and Java arrays in lexicographic order, on which compare throws exceptions. Also unlike compare, cc-cmp can compare values of different types to each other without throwing an exception, if it can compare them at all. Values of different types are sorted relative to each other by a string that is the name of their class. Note that all numbers use the string "java.lang.Number" so that numbers are sorted together, rather than separated out by type, and for a similar reason all vectors, lists, and sequences use the string "clojure.lang.Sequential". All sets use the string "clojure.lang.IPersistentSet", and all maps and records use the string "clojure.lang.IPersistentMap". All Java arrays use the string "java.util.Arrays" (that is not the name of any instantiable class -- it is simply used for sorting Java arrays versus other objects). cc-cmp throws an exception if given any type of value not mentioned above, e.g. Java arrays.
thalia.comparators/cc-cmp found in 1 def, across 1 project.
Search for vars with similar names in all artifacts: cc-cmp
Search for cc cmp in the documentation of all artifacts.
1 usage in
Documentation for Clojure functions, macros, protocols, vars