Hi,
I have a question about the scope of "binding" of a var.
Let's say I have the following var:
(def *v* 1)
And I define a function that uses it:
(defn f [n] (+ *v* n))
"binding" behaves as expected, establishing a thread-local binding to
a new value in its scope:
user=> (binding [*v* 2] (f 1))
3
But if I pass it to "map", I expected it to pick up the new value, but
it does not.
user=> (binding [*v* 2] (map f [1 1 1]))
(2 2 2)
The output should be "(3 3 3)" if I understand it correctly. Where am I wrong?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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