is the @ symbol the same as a var-get . . . or is that and atom. 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. . .
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? Thanks. On Sun, Jan 11, 2009 at 10:27 PM, Timothy Pratley <timothyprat...@gmail.com>wrote: > > > thread should own the memory that's created. Each thread should have > > its own asynchronous stack to push local variables onto that no one > > else is allowed to see. > > Just for the record, Clojure does support local variable that behave > exactly as you would expect them: > (with-local-vars [x 3] > (while (> @x 0) > (var-set x (- @x 1))) > @x) > -> 0 > > Using an atom is unnecessary in this case because access is totally > local. Using an unsafe atom set is a bad habit, as discussed in detail > on another thread: > > http://groups.google.com/group/clojure/browse_thread/thread/6497e7c8bc58bb4e/c5b3c9dbe6a1f5d5 > > However as you have already seen there are more elegant ways to write > the solution without either. > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---