You're viewing version 1.2.0 of max-key. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16



  • (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.

1 Example top

  • user=> (max-key count "asd" "bsd" "dsd" "long word")
    "long word"
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:3947 top

(defn max-key
  "Returns the x for which (k x), a number, is greatest."
  {:added "1.0"}
  ([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)))
Vars in clojure.core/max-key: > defn reduce
Used in 0 other vars

Comments top

No comments for max-key. Log in to add a comment.