summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2010-02-16 20:20:33 -0500
committerRich Hickey <richhickey@gmail.com>2010-02-16 20:20:33 -0500
commit49a7d6b8e14050a45df5332e768ba6647752215d (patch)
treec43775e3de460557ecc651609f5490fd2d1abf99
parent23f612edadfd629315c68d8962eaf86ee177d687 (diff)
inline identical?
-rw-r--r--src/clj/clojure/core.clj13
-rw-r--r--src/jvm/clojure/lang/RT.java9
2 files changed, 10 insertions, 12 deletions
diff --git a/src/clj/clojure/core.clj b/src/clj/clojure/core.clj
index cba510a8..b3b01ba8 100644
--- a/src/clj/clojure/core.clj
+++ b/src/clj/clojure/core.clj
@@ -318,7 +318,7 @@
(defn nil?
"Returns true if x is nil, false otherwise."
{:tag Boolean}
- [x] (identical? x nil))
+ [x] (clojure.lang.Util/identical x nil))
(def
@@ -381,12 +381,12 @@
(defn false?
"Returns true if x is the value false, false otherwise."
{:tag Boolean}
- [x] (identical? x false))
+ [x] (clojure.lang.Util/identical x false))
(defn true?
"Returns true if x is the value true, false otherwise."
{:tag Boolean}
- [x] (identical? x true))
+ [x] (clojure.lang.Util/identical x true))
(defn not
"Returns true if x is logical false, false otherwise."
@@ -574,6 +574,13 @@
([test then else]
`(if (not ~test) ~then ~else)))
+(defn identical?
+ "Tests if 2 arguments are the same object"
+ {:tag Boolean
+ :inline (fn [x y] `(. clojure.lang.Util identical ~x ~y))
+ :inline-arities #{2}}
+ ([x y] (clojure.lang.Util/identical x y)))
+
(defn =
"Equality. Returns true if x equals y, false if not. Same as
Java x.equals(y) except it also works for nil, and compares
diff --git a/src/jvm/clojure/lang/RT.java b/src/jvm/clojure/lang/RT.java
index 2743d2a7..40d279f0 100644
--- a/src/jvm/clojure/lang/RT.java
+++ b/src/jvm/clojure/lang/RT.java
@@ -286,15 +286,6 @@ static{
});
v.setMeta(map(dockw, "Sequentially read and evaluate the set of forms contained in the file.",
arglistskw, list(vector(namesym))));
- v = Var.intern(CLOJURE_NS, IDENTICAL,
- new AFn(){
- public Object invoke(Object arg1, Object arg2)
- throws Exception{
- return arg1 == arg2 ? RT.T : RT.F;
- }
- });
- v.setMeta(map(dockw, "Tests if 2 arguments are the same object",
- arglistskw, list(vector(Symbol.create("x"), Symbol.create("y")))));
try {
doInit();
}