Skip to content

Instantly share code, notes, and snippets.

@alexhall
Created April 1, 2013 17:51
Show Gist options
  • Save alexhall/5286484 to your computer and use it in GitHub Desktop.
Save alexhall/5286484 to your computer and use it in GitHub Desktop.
declaring dynamic functions
;; internal helper function
(defn default-foo [] "Hello, world!")
;; public API
(def ^:dynamic *foo* default-foo)
(defn bar [] (*foo*))
;; Usage
(bar)
(binding [*foo* #("Goodbye, world!")]
(bar))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment