function/macro | since v0.0-927 | clojure.core/min | Edit |
(min x)
(min x y)
(min x y & more)
Returns the least number argument.
(min 1 2 3 4)
;; => 1
Apply it to a collection:
(apply min [1 2 3 4])
;; => 1
Returns the least of the nums.
(defn ^number min
([x] x)
([x y] (cljs.core/min x y))
([x y & more]
(reduce min (cljs.core/min x y) more)))
(core/defmacro ^::ana/numeric min
([x] x)
([x y] `(let [x# ~x, y# ~y]
(~'js* "((~{} < ~{}) ? ~{} : ~{})" x# y# x# y#)))
([x y & more] `(min (min ~x ~y) ~@more)))