Thank you, that works great! It's a nice use of destructuring too, which I should of thought of.
I guess this is one case where solving the problem in pieces does not help. Actually, I seem to remember seeing idioms like that for other macros over sequences. I understand a little more now why. > What's the use case for this? A map can be used as a function translating a numeric code to a keyword (e.g., an event code). There may be very large maps of this type, but you might also want predicates to test whether something is of a given type. Might as well generate them from the map you already have. I modified your solution so it fits my use case: (defmacro make-predicates [kvs] `(do ~@(map (fn [[v k]] `(defn ~(symbol (str (name k) "?")) [~'x] (= ~'x ~v))) (eval kvs)))) The eval is needed so I can pass in a variable, and I used the defn form so I could get a regular true-false predicate. Thanks for a great lesson on macros! -- 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