Clojure macro: Create local vars from a map [duplicate]
问题 This question already has answers here : In Clojure, how to destructure all the keys of a map? (3 answers) Closed 10 months ago . I have this sample code where I create vars by iterating over the key value pair of the map. (defmacro block [bindings & body] `(let [ ~@(mapcat (fn [[k v]] [(if (symbol? k) k (symbol (name k))) `~v]) bindings) ] ~body)) (block {:a 1 :b 2} (if true (prn "true" a b) (prn "false"))) It works fine. Ouput: "true" 1 2 But now I want to pass the same map as a var but, it