tags:

views:

303

answers:

5

Does not exist?

+13  A: 

Does exist:

Clojure 1.2.0
user=> (not= 1 2)
true
user=> (not= 1 1)
false
abhin4v
+1  A: 

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

girlygirl
A: 

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

JUST MY correct OPINION
+12  A: 
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
Rayne
I suspect that clojure eschews the != syntax in order to maintain the idiomatic usage of the ! character to indicate functions that must take place inside a transaction.
Alex Stoddard
Indeed. In Java and similar languages, ! means negation. If not= were !=, it would be grossly inconsistent.
Rayne
+2  A: 

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"

Arthur Ulfeldt
sorry if that post was putting ! functions in a bad light. they are really useful and are actually safe to use :)
Arthur Ulfeldt