Skip to content

Instantly share code, notes, and snippets.

@gfredericks
Created October 17, 2011 18:32
Show Gist options
  • Select an option

  • Save gfredericks/1293389 to your computer and use it in GitHub Desktop.

Select an option

Save gfredericks/1293389 to your computer and use it in GitHub Desktop.
Flexible config via defn-macro
(def *config* nil)
(defn wrap-configged-fn
[f]
(fn [& [maybe-config :as args]]
(if (and *config* (not (identical? *config* maybe-config)))
(apply f *config* args)
(apply f args))))
(defmacro defn-with-config
... ; wrap with above fn
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment