qrest
qrest

Reputation: 2417

Clojure does not have !=?

Does not exist?

Upvotes: 3

Views: 532

Answers (5)

Arthur Ulfeldt
Arthur Ulfeldt

Reputation: 91607

In a lot of clojure code the ! char means that a function changes the state of something in a way you should watch out for. the clojure transients make heavy use of these

compare-and-set! 
alter-meta!
conj!
persistent!

check out http://clojure.github.com/clojure/ and search for the ! character. these functions usually come with caveats like "must be free of side effects"

Upvotes: 6

Abhinav Sarkar
Abhinav Sarkar

Reputation: 23812

Does exist:

Clojure 1.2.0
user=> (not= 1 2)
true
user=> (not= 1 1)
false

Upvotes: 18

Rayne
Rayne

Reputation: 32675

user=> (doc not=)
-------------------------
clojure.core/not=
([x] [x y] [x y & more])
  Same as (not (= obj1 obj2))
nil

Amusingly, you could define != to be the same as not= if you really wanted:

user=> (def != not=)
#'user/!=
user=> (!= 2 2)
false
user=> (!= 2 3)
true

Upvotes: 16

JUST MY correct OPINION
JUST MY correct OPINION

Reputation: 36107

Is there some reason not= doesn't suit your purposes?

Upvotes: 0

girlygirl
girlygirl

Reputation: 183

According to my google search "not=" is the equivalent but I have zero personal familiarity with Clojure.

Upvotes: 4

Related Questions