• (quot num div)
quot[ient] of dividing numerator by denominator.

2 Examples top

  • ;; (quot m n) is the value of m/n, rounded towards 0 to the nearest integer.
    ;; m, n need not be integers.
    
    user=> (quot 10 3)
    3
    
    user=> (quot 11 3)
    3
    
    user=> (quot 12 3)
    4
    
    user=> (quot -5.9 3)
    -1.0
    
    user=> (quot 10 -3)
    -3
    
    user=> (quot 15 0)
    ArithmeticException / by zero  clojure.lang.Numbers.quotient (Numbers.java:1764)
    
  • ;; note that the "/" function and the quot function are not equivalent
    
    user=> (= (/ 4 2) (quot 4 2))
    true
    
    user=> (= (/ 3 2) (quot 3 2))
    false
    
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:1196 top

(defn quot
  "quot[ient] of dividing numerator by denominator."
  {:added "1.0"
   :static true
   :inline (fn [x y] `(. clojure.lang.Numbers (quotient ~x ~y)))}
  [num div]
    (. clojure.lang.Numbers (quotient num div)))
Vars in clojure.core/quot:
Used in 0 other vars

Comments top

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