You're viewing version 1.2.0 of max. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16
  • (max x)
  • (max x y)
  • (max x y & more)
Returns the greatest of the nums.

2 Examples top

  • user=> (max 1 2 3 4 5)  
    5
    user=> (max 5 4 3 2 1)
    5
    user=> (max 100)
    100
    
  • ;; If elements are already in a sequence, use apply
    user=> (apply max [1 2 3 4 3])
    4
    user=> (apply max '(4 3 5 6 2))
    6
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:912 top

(defn max
  "Returns the greatest of the nums."
  {:added "1.0"}
  ([x] x)
  ([x y] (if (> x y) x y))
  ([x y & more]
   (reduce max (max x y) more)))
Vars in clojure.core/max: > defn reduce

Comments top

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