> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---