Created
April 15, 2011 03:07
-
-
Save swannodette/921056 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
(defmacro defrel [name & args] | |
(let [setsym (symbol (str name "-set")) | |
idxsym (symbol (str name "-indexed"))] | |
`(do | |
(defmacro ~name [~@args] | |
`(fn [a#] | |
(answers a# ~~setsym ~~idxsym [~~@args]))) | |
(def ~setsym (atom #{})) | |
(def ~idxsym (atom {}))))) | |
;; when the macro'ed macro is run I see | |
(fn [a__1307533__auto__] | |
(answers | |
a__1307533__auto__ | |
#<Atom@4e22b7dc: #{}> ;; <-- I want symbols here | |
#<Atom@72402ecb: {}> ;; <-- and here | |
['even? q])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment