ClojureDocs

导航

命名空间

not=

clojure.core

1.0 版本后推出 (来源)
  • (not= x)
  • (not= x y)
  • (not= x y & 更多)
Same as (not (= obj1 obj2))
3 Examples
user=> (not= 1 1)
false

user=> (not= 1 2)
true

user=> (not= true true)
false

user=> (not= true false)
true

user=> (not= true true true true)
false

user=> (not= true true false true)
true
;; See the Clojure Equality guide for more details:
;; https://clojure.org/guides/equality
;; An exception to the docstring:

(not= ##NaN ##NaN)
;; => false

(not (= ##NaN ##NaN))
;; => true

;; This is because of various shortcuts for checking identity when checking equality.
;; As a rule of thumb, don't rely on either for testing against the ##NaN literal.
;; Decide on which logic you want, and explicitly test. E.g.

(defn != [x y]
  (or (not= x y)
      (NaN? x)
      (NaN? y)))

(!= ##NaN ##NaN)
;; => true
See Also

Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works ...

Added by verma

Returns true if x is logical false, false otherwise.

Added by verma
0 Notes
No notes for not=