I see. It's hard to imagine how this could work, since macros don't have access to runtime data like the value of x in your example. Perhaps you're better off writing a function that returns a closure, and iteratively def'ing those?
user=> (defn make-kw-fn [kw] #(= kw %)) #'user/make-kw-fn user=> (def kws [:a :b]) #'user/kws user=> (eval (cons 'do (map #(list 'def (symbol (str "test-" (name %))) (make- kw-fn %)) kws))) #'user/test-b user=> (test-b :a) false user=> (test-b :b) true On Sep 10, 1:37 pm, icemaze <icem...@gmail.com> wrote: > Alan, thank you for your reply. > Unfortunately your solution is very similar to mine and it suffers > from the same problem (maybe I'm using it incorrectly, I don't know). > If I write: > > (doseq [x '(:a :b)] > (make-fn x)) > > it defines a single function "synthetic-x". Is there a way to make > this work? I tried everything but both eval and var-get don't work for > local bindings. > > Thanks again. -- 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