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