Skip to content

Instantly share code, notes, and snippets.

@MayDaniel
Created October 22, 2010 15:37
Show Gist options
  • Save MayDaniel/640781 to your computer and use it in GitHub Desktop.
Save MayDaniel/640781 to your computer and use it in GitHub Desktop.
(defmacro with-out-str
[& body]
`(let [s# (new java.io.StringWriter)]
(binding [*out* s#]
(let [result# (do ~@body)]
[(str s#) result#]))))
(defmacro with-out-str
[& body]
`(let [s# (new java.io.StringWriter)]
(binding [*out* s#]
[(do ~@body) (str s#)])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment