Does not exist?
+13
A:
Does exist:
Clojure 1.2.0
user=> (not= 1 2)
true
user=> (not= 1 1)
false
abhin4v
2010-09-07 06:42:23
+1
A:
According to my google search "not=" is the equivalent but I have zero personal familiarity with Clojure.
girlygirl
2010-09-07 06:42:37
A:
Is there some reason not=
doesn't suit your purposes?
JUST MY correct OPINION
2010-09-07 06:46:21
+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
2010-09-07 06:47:40
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
2010-09-07 14:52:24
Indeed. In Java and similar languages, ! means negation. If not= were !=, it would be grossly inconsistent.
Rayne
2010-09-07 16:35:54
+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
2010-09-07 19:59:43
sorry if that post was putting ! functions in a bad light. they are really useful and are actually safe to use :)
Arthur Ulfeldt
2010-09-08 17:58:50