> That said, I'd rather make sure that my low-level data structures are being 
> operated on by only one implementation.

You could use closures to encapsulate the refs/atoms ...

(let [car-mem (ref nil)]
  (defn set-car-mem [new-car-mem]
     (dosync (ref-set car-mem new-car-mem)))
  (defn update-car-mem [new-car-mem]
     (dosync (set-car-mem new-car-mem)))
  (defn get-car-mem [] @car-mem))

user=> (set-car-mem 0)
user=> (get-car-mem)
0
user=> @car-mem
java.lang.Exception: Unable to resolve symbol: car-mem in this context
(NO_SOURCE_FILE:0)

(note that you need a do-sync around ref-set - your code didn't have one.)

-Rgds, Adrian

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

Reply via email to