To compare the value of the atom, you should deref it first. Using deref, you’ll get the current value of the atom:
=> (deref a) 0 Or using the reader macro: => @a 0 So: => (= @a 0) true Hope that helps, Max > On Feb 12, 2015, at 11:27, Newbie <yash.a.kel...@gmail.com> wrote: > > I am trying to compare atom values with numbers. For e.g. - > > (def a (atom 0)) > (print a) gives --> #<Atom@2bcca11e: 0> > (= a 0) gives --> false > > How do I make this work? How do I compare 0 with the atom value? I want to do > the same for a string to? > I cannot use compare-and-set! for my situation. > > Thanks! > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > <http://groups.google.com/group/clojure?hl=en> > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com > <mailto:clojure+unsubscr...@googlegroups.com>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.