Skip to content

clojure.core/==

View this page on ClojureDocs

Type: function Added: Clojure 1.0 Examples: 6 Runnable: 5
([x] [x y] [x y & more])

Returns non-nil if nums all have the equivalent value (type-independent), otherwise false

Examples

by james on . May have evaluation errors.
by h3x3d on
by phreed on
by wontheone1 on
by jafingerhut on
by berczeck on

Note by gstamp

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

Note by popopome

So what is difference with =?

Note by mattharden

'== is defined only for numbers, where '= is general equality. The example showing (== :foo) as true is a bit misleading because (== :foo :foo) produces an exception. Unary == always returns true as an optimization.

See also


Content from the matching ClojureDocs page, with authors credited on each contribution.