Skip to content

Instantly share code, notes, and snippets.

@timsgardner
Last active August 29, 2015 14:08
Show Gist options
  • Save timsgardner/9a02cbbeea4af298cc4a to your computer and use it in GitHub Desktop.
Save timsgardner/9a02cbbeea4af298cc4a to your computer and use it in GitHub Desktop.
awesome-fn
(def ^:dynamic *x* :default-x)
(def ^:dynamic *y* :default-y)
(def ^:dynamic *z* :default-z)
(def ^:dynamic *opts* {:x *y* :y *z* :z *x*})
(defn awesome-fn [f x y z & {:as opts
:keys [x y z]
:or {x *x*
y *y*
z *z*}}]
(let [opts1 *opts*]
(binding [*opts* (merge opts1 opts)]
(apply f x y z (apply concat (merge opts opts1))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment