I had a think about using Clojure rather than go to a separate template system. Here's a horrible hack that uses eval to support string templates:
(ns clj-template.core (:require [clojure.contrib.string :as string])) (defn remove-templating [s] (string/replace-re #"#" "\"" s)) (defn build-code [s] (str "(str \"" (remove-templating s) "\")")) (defmacro foreach [loop-stuff & body] `(apply str (for ~loop-stuff (str ~@body)))) (defn eval-template [s] (-> (build-code s) read-string eval)) In the templates anything surrounded by #'s (hashes) is a clojure form that should be a compatible argument to str. On Mar 29, 3:13 pm, B Smith-Mannschott <bsmith.o...@gmail.com> wrote: > > (defn constructor > [{:keys [class-name fields] :as cfg}] > [" " class-name "(" (formal-params cfg) ") {\n" > (statement-list > (for [f fields] > [" this." f " = " f ])) > " }\n"]) > Then becomes: (eval-string " public Example(#(format-params cfg)#) { #(foreach [f fields]# this.#f# = #f#; #)# }") The general idea might be applicable to what you want. Saul -- 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