liveBook · Manning

Not=

As explained in Clojure: The Essential Reference

not= is a Clojure comparison function that returns the logical negation of = for its arguments.

Use `not=` when you want the opposite of Clojure’s `=` comparison. It returns a boolean and is shorter than `(not (= a b))`. It accepts one or more arguments; with one argument, it returns `false`. section 6.1

Comparing values

`(not= 1 2)` ⇒ `true` `(not= "a" "a")` ⇒ `false` `(not= 1 2 1)` ⇒ `true` For multiple arguments, `not=` means “not all equal,” not “every value is distinct.” section 6.1

The result depends on the equality rules of `=`. For compatible collections, that can mean comparing contents rather than container types; ordered collections compare contents in order, while maps and sets ignore order. Unlike `not`, which negates the truthiness of one value, `not=` negates an equality comparison. section 6.1 section 3.2.1

How Clojure: The Essential Reference covers it

How deep it goes
Defines its arities and boolean result, then relates its behavior to = and Clojure’s equality rules.
Examples
Shows numeric inequality and a repeated-string equality example, alongside a multi-argument = call.
What it assumes
Assumes familiarity with Clojure function calls while specifying the comparison contract from its required first argument.
What you can do after
Apply it via Clojure’s not= to test whether compared arguments are not all equal.
How it connects
Connects not= to =, boolean negation, and equality across Clojure collection types.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Clojure: The Essential Reference. The section links point to the parts of the book it draws on.