Last active
August 29, 2015 14:00
-
-
Save luxbock/11249913 to your computer and use it in GitHub Desktop.
This file contains 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
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