(defn ==
"Returns non-nil if nums all have the same value, otherwise false"
{:inline (fn [x y] `(. clojure.lang.Numbers (equiv ~x ~y)))
:inline-arities #{2}
:added "1.0"}
([x] true)
([x y] (. clojure.lang.Numbers (equiv x y)))
([x y & more]
(if (== x y)
(if (next more)
(recur y (first more) (next more))
(== y (first more)))
false)))
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