;; rem and mod are commonly used to get the remainder. ;; but when dealing with negative num(ber), the difference ;; between rem and mod becomes obvious user=> (mod -10 3) 2 user=> (rem -10 3) -1
(defn rem
"remainder of dividing numerator by denominator."
{:added "1.0"
:static true
:inline (fn [x y] `(. clojure.lang.Numbers (remainder ~x ~y)))}
[num div]
(. clojure.lang.Numbers (remainder num div)))
Comments top
No comments for rem. Log in to add a comment.