Last active
August 29, 2015 14:01
-
-
Save joelkuiper/38ff5b7cadc1b18339cd 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
(def get-var | |
(memoize | |
(fn [ns sym] | |
(let [path (str (s/replace ns "." "/") "/" sym ".clj") | |
f (io/as-file (io/resource path))] | |
(when (not (nil? f)) | |
(load-string (slurp f)) | |
(when-let [s (find-var (symbol (str ns "/" sym)))] | |
(var-get s))))))) | |
;; Used as to get a topology var defined in the file resources/topologies/<name> | |
(defn get-topology | |
[name] | |
(get-var (str "topologies." name) "topology")) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment