An order property determines how values relate from smaller to larger, larger to smaller, or equal. Clojure uses this relationship in numeric predicates such as <, >, <=, and >=, and in max and min. section 5.8 section 6.3
Clojure’s ordering predicates check the relationship across every neighboring argument:
- < requires strict increase; <= permits equal neighboring values; > requires strict decrease; >= permits equality. section 6.3
- With one argument, every predicate returns true and accepts any type. With two or more arguments, all arguments must be numeric. section 6.3
- No arguments cause an ArityException; a nonnumeric multi-argument call causes a ClassCastException. section 6.3
- max and min return the largest or smallest numeric argument, while Infinity dominates in its corresponding direction and NaN propagates through either operation. section 5.8
Chaining an ordering check
(< 0 (byte 1) 2 2.1 3N 4M 21/2) ;; true (< 0 (byte 1) 2 2.1 3N 2M 21/2) ;; false (sort > (range 5)) ;; (4 3 2 1 0) section 6.3
Listing 6.3. → Comparison Operators, Ordering
(< ([x]) ([x y]) ([x y & more])) (> ([x]) ([x y]) ([x y & more])) (<= ([x]) ([x y]) ([x y & more])) (>= ([x]) ([x y]) ([x y & more]))
Browse the comparison operators’ arities and ordering-oriented signatures. section 6.3







