Last active
August 29, 2015 13:57
-
-
Save skatenerd/9556675 to your computer and use it in GitHub Desktop.
thank you colin jones
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
(defmacro def-defaults [name args defaults & exprs] | |
`(defn ~name [~@args & {:keys ~(vec (keys defaults)) :or ~defaults}] | |
~@exprs)) | |
(def-defaults use-the-operator [a b] {operator +} (operator a b)) | |
(prn "--------------------------") | |
(prn (use-the-operator 1 2)) ; --> 3 | |
(prn (use-the-operator 1 2 :operator *)) ; --> 2 | |
(prn "--------------------------") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Look I'm writing closure