deref is used to pull the value out of an atom, ref, or atom (or other
reference type).

(= (deref a) 0)  gives --> true

Also there is a shorthand operator:

(= @a 0)

Timothy

On Thu, Feb 12, 2015 at 12:27 PM, 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
> ---
> 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.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
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.

Reply via email to