We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dfbb852 commit 1f47f47Copy full SHA for 1f47f47
src/clj/clojure/core.clj
@@ -1845,6 +1845,16 @@
1845
(instance? Short n)
1846
(instance? Byte n)))
1847
1848
+(defn mod
1849
+ "modulus of num and div."
1850
+ [num div]
1851
+ (cond
1852
+ (or (not (integer? num)) (not (integer? div)))
1853
+ (throw (IllegalArgumentException.
1854
+ "mod requires two integers"))
1855
+ (or (< num 0 div) (< div 0 num)) (+ (rem num div) div)
1856
+ :else (rem num div)))
1857
+
1858
(defn ratio?
1859
"Returns true if n is a Ratio"
1860
[n] (instance? clojure.lang.Ratio n))
0 commit comments