user=> (= 1)
true
user=> (= 1 1)
true
user=> (= 1 2)
false
user=> (= 1 1 1)
true
user=> (= 1 1 2)
false
user=> (= '(1 2) [1 2])
true
user=> (= nil nil)
true
;; It should be noted that equality is not defined for Java arrays.
;; Instead you can convert them into sequences and compare them that way.
;; (= (seq array1) (seq array2))
user=> (= 1)
true
user=> (= 1 1)
true
user=> (= 1 2)
false
user=> (= 1 1 1)
true
user=> (= 1 1 2)
false
user=> (= '(1 2) [1 2])
true
user=> (= nil nil)
true
;; It should be noted that equality is not defined for Java arrays.
;; Instead you can convert them into sequences and compare them that way.
;; (= (seq array1) (seq array2))
Comments top
1 comment(s) for =.
There is a difference between "=" and "==". For primitives you definitely want to use "==" as "=" will result in a cast to the wrapped types for it's arguments.
This may not be the case come Clojure 1.3 (see [1])
[1] http://github.com/clojure/clojure/commit/df8c65a286e90e93972bb69392bc106128427dde