Skip to content

Instantly share code, notes, and snippets.

@jcromartie
Created December 20, 2010 21:55
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 jcromartie/749062 to your computer and use it in GitHub Desktop.
Save jcromartie/749062 to your computer and use it in GitHub Desktop.
(def *indent* 0)
(def *real-println* println)
(defmacro with-indent
[& body]
`(binding [*indent* (inc *indent*)
println (fn [& xs#]
(let [indent# (apply str (take *indent* (repeat " ")))]
(*real-println* (str indent# (apply str (interpose " " xs#))))))]
~@body))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment