• (mod num div)
Modulus of num and div. Truncates toward negative infinity.

1 Example top

  • user=> (mod 10 5)
    0
    
    user=> (mod 10 6)
    4
    
    user=> (mod 10 10)
    0
    
    user=> (mod 10 -1)
    0
    
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:3159 top

(defn mod
  "Modulus of num and div. Truncates toward negative infinity."
  {:added "1.0"
   :static true}
  [num div] 
  (let [m (rem num div)] 
    (if (or (zero? m) (= (pos? num) (pos? div)))
      m 
      (+ m div))))
Vars in clojure.core/mod:
Used in 0 other vars

Comments top

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