diff options
author | Kevin Downey <redchin@gmail.com> | 2010-01-29 12:08:50 -0800 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2010-03-11 07:22:03 -0500 |
commit | 5772be9fc5ac9ddf92b727908c20b9aab971224a (patch) | |
tree | 67ef37fb9f99fe99c7452345c7e97f4f8c5de589 /src | |
parent | e2cdf7dea9b0a459e781e4da320817be56aa6a8d (diff) |
numerator and denominator fns for Ratios, refs #255
Signed-off-by: Rich Hickey <richhickey@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/clj/clojure/core.clj | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj index e2cf386e..1f46b487 100644 --- a/src/clj/clojure/core.clj +++ b/src/clj/clojure/core.clj @@ -2402,6 +2402,18 @@ "Returns true if n is a Ratio" [n] (instance? clojure.lang.Ratio n)) +(defn numerator + "Returns the numerator part of a Ratio." + {:tag BigInteger} + [r] + (.numerator #^clojure.lang.Ratio r)) + +(defn denominator + "Returns the denominator part of a Ratio." + {:tag BigInteger} + [r] + (.denominator #^clojure.lang.Ratio r)) + (defn decimal? "Returns true if n is a BigDecimal" [n] (instance? BigDecimal n)) |