Skip to content

Instantly share code, notes, and snippets.

@luxbock luxbock/test.clj
Last active Aug 29, 2015

Embed
What would you like to do?
user> (defmacro fundef [a b]
`(defn ~(symbol (str "plus-" a "-" b)) [arg#] (+ ~a ~b arg#)))
#'user/fundef
user> (fundef 1 2)
#'user/plus-1-2
user> (plus-1-2 3)
6
user> (map #(fundef %1 %2) (range 3) (range 3))
(#'user/plus-p1__10068#-p2__10069# #'user/plus-p1__10068#-p2__10069# #'user/plus-p1__10068#-p2__10069#)
user> (plus-0-0 1)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: plus-0-0 in this context, compiling:(/private/var/folders/j2/zvt92c1s39d_0kdmhrhbgtkm0000gn/T/form-init2306553905059976750.clj:1:1)
user>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.