Hi, I'm new to clojure too..
> Is this the way it's supposed to work?
Yes.. I'd expect that to modify the root value of the var _outside_ of
the thread-local binding..
See the following comment on
http://clojure.sourceforge.net/reference/special_forms.html
"Using def to modify the root value of a var at other than the top
level is usually an indication that you are using the var as a mutable
global, and is considered bad style. Consider either using binding to
provide a thread-local value for the var, or putting a ref or agent in
the var and using transactions or actions for mutation."
This might be what you wanted to achieve.. but I'll let others comment
on when it's appropriate to use (set! ....).
user=> (def x 19)
#<Var: user/x>
user=> (binding [x 1] (println x) (set! x 2) (println x))
1
2
nil
user=> x
19
--Jon