Andreas Kostler wrote: > Hi all, > Suppose I have the following function: > (defn foo [x changeling] > (cond > (= (first x) 'bar) > (map #(foo % changeling) (rest x)))) > > (def foobar (atom {:something "in-here"})) > > Now, changeling gets bound to (atom {:something "in-here"}).
Erm.. no? where? > The > conditional in foo might contain another case that actually changes > changeling. As a matter of style and readability: don't do that. Have (foo whatever) return a new value for whatever, then use (swap! foobar foo) or something similar. > How can I avoid the binding of changeling to the initial value of the > atom and have the anonymous function passed to map use the current > (possibly changed) value of changeling? You might not want to do this in any function passed to map, since map is lazy. -- 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