Skip to content

Commit

Permalink
route all coercions through RT
Browse files Browse the repository at this point in the history
  • Loading branch information
richhickey committed Apr 27, 2010
1 parent f0cfe0a commit 37d8f7a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/clj/clojure/core.clj
Expand Up @@ -2330,31 +2330,31 @@
"Coerce to long"
{:tag Long
:inline (fn [x] `(. clojure.lang.RT (longCast ~x)))}
[^Number x] (. x (longValue)))
[^Number x] (clojure.lang.RT/longCast x))

(defn float
"Coerce to float"
{:tag Float
:inline (fn [x] `(. clojure.lang.RT (floatCast ~x)))}
[^Number x] (. x (floatValue)))
[^Number x] (clojure.lang.RT/floatCast x))

(defn double
"Coerce to double"
{:tag Double
:inline (fn [x] `(. clojure.lang.RT (doubleCast ~x)))}
[^Number x] (. x (doubleValue)))
[^Number x] (clojure.lang.RT/doubleCast x))

(defn short
"Coerce to short"
{:tag Short
:inline (fn [x] `(. clojure.lang.RT (shortCast ~x)))}
[^Number x] (. x (shortValue)))
[^Number x] (clojure.lang.RT/shortCast x))

(defn byte
"Coerce to byte"
{:tag Byte
:inline (fn [x] `(. clojure.lang.RT (byteCast ~x)))}
[^Number x] (. x (byteValue)))
[^Number x] (clojure.lang.RT/byteCast x))

(defn char
"Coerce to char"
Expand All @@ -2366,7 +2366,7 @@
"Coerce to boolean"
{:tag Boolean
:inline (fn [x] `(. clojure.lang.RT (booleanCast ~x)))}
[x] (if x true false))
[x] (clojure.lang.RT/booleanCast x))

(defn number?
"Returns true if x is a Number"
Expand Down

0 comments on commit 37d8f7a

Please sign in to comment.