identical?

clojure.core

  • (identical? x y)
Tests if 2 arguments are the same object

2 Examples top

  • user=> (def x 1)
    #'user/x
    user=> (identical? x x)
    true
    user=> (identical? x 1)
    true
    user=> (identical? x 2)
    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
    
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:710 top

(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)))
Vars in clojure.core/identical?:
Used in 0 other vars

Comments top

No comments for identical?. Log in to add a comment.