Created
February 8, 2012 01:22
-
-
Save timvisher/1764014 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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