Hi,

here my try:

(def *deferred-bindings* {})

(defmacro do-binding
  [& body]
  `(with-bindings *deferred-bindings*
     ~@body))

(defmacro bind-later
  [bindings & body]
  (let [vars   (map (fn [v] `(var ~v)) (take-nth 2 bindings))
        values (take-nth 2 (next bindings))]
    `(binding [*deferred-bindings* (merge *deferred-bindings*
                                          ~(zipmap vars values))]
       ~@body)))


user=> (def a "outer a")
#'user/a
user=> (bind-later [a "inner a"] (println a) (do-binding (println a)))
outer a
inner a
nil

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