max-key

added
1.0

ns
clojure.core

type
function

(max-key k x) (max-key k x y) (max-key k x y & more)

Returns the x for which (k x), a number, is greatest.

                user=> (max-key count "asd" "bsd" "dsd" "long word")
"long word"
            
                ; find the key that has the highest value in a map
user=> (key (apply max-key val {:a 3 :b 7 :c 9}))
:c