user=> (abs -2) 2 user=> (abs 2) 2 user=> (abs 0) 0
(defn abs "(abs n) is the absolute value of n" [n] (cond (not (number? n)) (throw (IllegalArgumentException. "abs requires a number")) (neg? n) (- n) :else n))
Comments top
No comments for abs. Log in to add a comment.