-
-
Save gabrielg/97ffff695c43b28d3f2b 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
(use 'clojure.contrib.repl-utils) | |
(use 'clojure.contrib.pprint) | |
(defmacro foo [arg] | |
`(fn [] (println "foo" ~arg)) | |
) | |
(defmacro bar [arg] | |
`(fn [] (println "bar" ~arg)) | |
) | |
(defmacro example [& args] | |
(map (fn [macro-name] | |
((resolve (symbol macro-name)) "example") | |
) args) | |
) | |
(def test-one (foo "example one")) | |
(def test-two (bar "example two")) | |
(test-one) | |
(test-two) | |
(def test-fn-vector (example "foo" "bar")) | |
(pprint test-fn-vector) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment