function | since v0.0-927 | clojure.core/max-key | Edit |
(max-key k x)
(max-key k x y)
(max-key k x y & more)
Returns the x
for which (k x)
is greatest.
(k x)
should return a number.
Returns the x for which (k x), a number, is greatest. If there are multiple such xs, the last one is returned.
(defn max-key
([k x] x)
([k x y] (if (> (k x) (k y)) x y))
([k x y & more]
(reduce #(max-key k %1 %2) (max-key k x y) more)))