Skip to content

Instantly share code, notes, and snippets.

@skatenerd
Last active August 29, 2015 13:57
Show Gist options
  • Save skatenerd/9556675 to your computer and use it in GitHub Desktop.
Save skatenerd/9556675 to your computer and use it in GitHub Desktop.
thank you colin jones
(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 "--------------------------")
@jah2488
Copy link

jah2488 commented Mar 14, 2014

Look I'm writing closure

`(--> (~@d & {:k ~(.Wow "code" :or ~such :and '[@readable {:much ~@syntax}])))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment