> is the @ symbol the same as a var-get . . . or is that an atom.

@ is a reader macro that translates to (deref ) which works on vars,
atoms, refs, agents.
and yes is interchangeable with var-get.

> Your sentence about atoms was very compound.  I'm not sure if you said that 
>you
> used an atom but you didn't have to . . . .or you didn't use an atom because
> it wasnt necessary . . . . or you did use an atom because it was necessary
> with 'with-local-vars', but it wasn't necessary to use 'with-local-vars'?
> So I don't understand your point, even after reading the thread you referred
> me to.  Did you use an unsafe atom?  I assume that's what you were saying.

I should have been more clear. Someone else recommended using an atom,
I was explaining why that might not be a good idea. I am not
advocating using either a variable or atom.

> incidentally, the following code works:
>
> (with-local-vars [x 3]
>  (while (> (var-get x) 0)
>    (var-set x (- (var-get x) 1)))
>  (var-get x))
>
> did I replace your use of unsafe atoms with closure.lang.Vars ???????? or,
> again, is @ just short hand for var-get?

Yup, just shorthand for var-get.


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

Reply via email to