For comparisons (= < <= > >= ==
) arity 3 and higher are much slower than doing e.g. (and (< a b) (< b c))
. The arity 3 is in my research rather less common but still used in e.g. Manifold stream.clj [0] or rrb_vector rrbt.clj [1]. Arity 3 is idiomatic in places, where you compare lower and upper bound for a "variable". However, I don't think arity 4 and higher is used much in practical code. At least I haven't found any interesting instances of such a use.
An example implementation (based on the one currently in core) could be:
(defn <'
"Returns non-nil if nums are in monotonically increasing order,
otherwise false."
{:inline (fn [x y] `(. clojure.lang.Numbers (lt ~x ~y)))
:inline-arities #{2}
:added "1.0"}
([x] true)
([x y] (. clojure.lang.Numbers (lt x y)))
([x y z] (and (<' x y) (<' y z)))
([x y z & more]
(if (<' x y z)
(if (next more)
(recur y z (first more) (next more))
(<' z (first more)))
false)))
[0] https://github.com/clj-commons/manifold/blob/c3fc69066f3abba0b5ab0f4c2b1c4338bcc61d19/src/manifold/stream.clj#L978
[1] https://github.com/clojure/core.rrb-vector/blob/master/src/main/clojure/clojure/core/rrb_vector/rrbt.clj