Last active
August 29, 2015 14:08
-
-
Save timsgardner/9a02cbbeea4af298cc4a to your computer and use it in GitHub Desktop.
awesome-fn
This file contains hidden or 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 ^: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