I'm not an expert in macros, and maybe this is a stupid question but i think there should be a general pattern for this.
I' ve a function: (defn choose* [f & choices] "Applies f to one of the choices" ..... .....) And this macro: (defmacro choose [[c choices] & body] `(choose* (fn [~c] ~@body) ~@choices)) Now if i call it with a literal sequence: (choose [x [:a :b :c]] (println x)) it correctly expands to: (choose* (fn [x] (println x)) :a :b :c) but if i have: (def y [:a :b :c]) (choose [x y] (println x)) it gives me an error: don't know how to create ISeq from symbol. with an expression: (choose [x (vec 2 3 4)] (println x)) it expands to: (choose* (fn [x] (println x)) vec 2 3 4) I knew it could not be that simple, and i also understand why i get theese expansions, but i don't get how to solve it. So what's the pattern for something like this, where you want to evaluate a symbol or an expression before expansion? Andrea -- 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