I did but it requires two levels of macro and that made me nervous. The problem is derived values. When defining a binding, near as I can tell, the values in the binding cannot see other values in the binding. In other words:
(def *A* 10) (binding [*A* 3 B (+ foo 1)] B) Returns 11, not 4. So to use the macro I have to: (def *A* bogus_value) (def B bogus_value) (defmacro in-environment [env & body] `(binding [*A* :A ..] (binding [B (+ *A* 1)...] ~...@body)) I think this would actually work. But it requires a bunch of accounting (all the bogus global defs) and introduces some worrisome ordering issues. For example, let's say I have a value C whose definition is (def C (+ B 1)). I can't define it using the previous macro. Because, again, bindings can't see each other. So now I'd have to write a macro that dynamically created a whole set of nested bindings. Which seems like a lot of work. In other words: (binding [*A* :A...] (binding [B (+ *A* 1)...] (binding [C (+ *B* 1)...] etc. And I can't use let (which does allow for internal visibility) because then other functions I call will bind to the global value not the let value. Yaron -- 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