user=> (def x 1) #'user/x user=> (identical? x x) true user=> (identical? x 1) true user=> (identical? x 2) false user=> (identical? x ((constantly 1) 8)) true user=> (identical? 'a 'a) false
user=> (def x {:foo 1, :bar -3})
#'user/x
user=> (def y {:foo 1, :bar -3})
#'user/y
;; Values are equal, but different objects were constructed
user=> (= x y)
true
user=> (identical? x y)
false
(defn identical?
"Tests if 2 arguments are the same object"
{:inline (fn [x y] `(. clojure.lang.Util identical ~x ~y))
:inline-arities #{2}
:added "1.0"}
([x y] (clojure.lang.Util/identical x y)))
Comments top
No comments for identical?. Log in to add a comment.