Skip to content

Instantly share code, notes, and snippets.

@sunilnandihalli
Created November 26, 2010 04:53
Show Gist options
  • Save sunilnandihalli/716293 to your computer and use it in GitHub Desktop.
Save sunilnandihalli/716293 to your computer and use it in GitHub Desktop.
a small example demonstrating the problem with symbol macros..
(ns symbol-macro-problem
(:require [clojure.contrib.macro-utils :as m]))
(defmacro sym-macro [& body]
`(m/symbol-macrolet [begin :begin
end :end]
(println begin)
~@body
(println end)))
(defmacro display-local-bindings []
`(do ~@(map (fn [x#] (list 'println [`'~x# x#])) (keys &env))))
(sym-macro
(let [x 10]
(display-local-bindings)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment