Skip to content

Instantly share code, notes, and snippets.

@gabrielg
Created November 8, 2009 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielg/97ffff695c43b28d3f2b to your computer and use it in GitHub Desktop.
Save gabrielg/97ffff695c43b28d3f2b to your computer and use it in GitHub Desktop.
(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