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
Returns the x for which (k x), a number, is greatest.
(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)))
Comments top
No comments for max. Log in to add a comment.