You're viewing version 1.2.0 of identical?. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16

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=> (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
    
Log in to add / edit an example.

See Also top

  • 1
    clojure.core/=

    Equality. Returns true if x equals y, false if not. Same as Java x.

  • 1
    clojure.core/==

    Returns non-nil if nums all have the same value, otherwise false

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:646 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?: defn

Comments top

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