On Fri, Dec 17, 2010 at 11:38 AM, Michael <mw10...@gmail.com> wrote: > > Ken/Alex, > > Thanks for taking the time to look at this and providing explanations/ > ideas. Now I realize I can use forms instead of strings. I was > looking for a way to specify a collection of strings and be able to > expand them out under different bindings. > > (def v 0) > (def coll ['(str "v: " v) '(<< "v: ~{v}")]) > (binding [v 7] > (map eval coll)) > => ("v: 0" "v: 0")
Closures would work better than eval here, and you need a doall around a map in a binding: (def v 0) (def coll [(fn [] (str "v: " v)) (fn [] (<< "v: ~{v}"))]) (binding [v 7] (doall (map #(%) coll))) -- 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