1.3.0 permalink Arrow_down_16x16
  • (/ x)
  • (/ x y)
  • (/ x y & more)
If no denominators are supplied, returns 1/numerator,
else returns numerator divided by all of the denominators.

2 Examples top

  • user=> (/ 6 3)
    2
    
    user=> (/ 6 3 2)
    1
    
    user=> (/ 10)
    1/10
    
    user=> (/ 1 3)
    1/3
    
    user=> (/)
    ArityException Wrong number of args (0) passed to: core$-SLASH-
    
    user=> (/ 1 0)
    java.lang.ArithmeticException
    
    user=> (/ 0)
    java.lang.ArithmeticException
    
  • ;;; Automatically handles floating point:
    
    user=> (/ 43.0 2)
    21.5
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:955 top

(defn /
  "If no denominators are supplied, returns 1/numerator,
  else returns numerator divided by all of the denominators."
  {:inline (nary-inline 'divide)
   :inline-arities >1?
   :added "1.0"}
  ([x] (/ 1 x))
  ([x y] (. clojure.lang.Numbers (divide x y)))
  ([x y & more]
   (reduce1 / (/ x y) more)))
Vars in clojure.core//:
Used in 0 other vars

Comments top

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