Created
September 12, 2011 22:42
-
-
Save boxxxie/1212685 to your computer and use it in GitHub Desktop.
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
;;i want a macro that makes defs for me. examples | |
;;(def stores "localhost:5984/stores") | |
;;(defDB) works the way i want it to, (defDBs) does not | |
;;i get errors of the form (can't resolve do) or (string can't be an IF). i'm not sure what i'm doing wrong. i've tried many variations | |
;; my aim is (do (defDB store) (defDB inv)) | |
(defmacro defDB [name] | |
`(def ~name ~(str *couchDB* name))) | |
(defmacro defDBs [& names] | |
`(concat (do) ~(map | |
(fn [name] | |
`(defDB ~name)) | |
names))) | |
(pprint (macroexpand-1 '(defDB store))) | |
(pprint (macroexpand-1 '(defDBs store inv))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment