Skip to content

Instantly share code, notes, and snippets.

@timvisher
Created February 8, 2012 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timvisher/1764014 to your computer and use it in GitHub Desktop.
Save timvisher/1764014 to your computer and use it in GitHub Desktop.
(defn- expand-template [template custom-expansions]
(let [expansions (into expansions custom-expansions)]
(loop [template template
expanded-template (clojure.walk/prewalk-replace expansions template)]
(if (= template expanded-template) expanded-template (recur expanded-template (clojure.walk/prewalk-replace expansions expanded-template))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment