I'm having trouble with a clojure project, and I cannot seem to find an answer. I am trying to compare two symbols:
'x 'y
But when I use:
(= ('x 'y))
It returns true. The same with:
(identical? 'x 'y)
I have found that identical compares memory addresses, but I have not found why 'x and 'y when compared return true? I have not seen a question like this, most of the other posts compare numbers.
You are comparing a list of symbols to nothing. If you only pass one argument to =, it returns true by default. Just remove the parentheses around the symbols and then you'll be comparing the symbols themselves. (= 'x 'y)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With