==

function/macrosince v0.0-927 clojure.core/==Edit
(== x)
(== x y)
(== x y & more)

Details:

This is an equality check for numbers of different types that was carried over from Clojure, to allow compatibility when converting code to ClojureScript.

Since there is only a single number type in JavaScript, 64-bit floating point, there is no reason to use the == operator in ClojureScript.

Behavior on non-number arguments is undefined.


Examples:

(== 1 1)
;;=> true

(== 1 2)
;;=> false

See Also:


Source docstring:
Returns non-nil if nums all have the equivalent
value, otherwise false. Behavior on non nums is
undefined.
Function code @ clojurescript:src/main/cljs/cljs/core.cljs
(defn ^boolean ==
  ([x] true)
  ([x y] (-equiv x y))
  ([x y & more]
   (if (== x y)
     (if (next more)
       (recur y (first more) (next more))
       (== y (first more)))
     false)))

Macro code @ clojurescript:src/main/clojure/cljs/core.cljc
(core/defmacro ^::ana/numeric ==
  ([x] true)
  ([x y] (bool-expr (core/list 'js* "(~{} === ~{})" x y)))
  ([x y & more] `(and (== ~x ~y) (== ~y ~@more))))