Skip to content

Instantly share code, notes, and snippets.

Created May 25, 2015 13:20
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 anonymous/34897ea9039a2bce427d to your computer and use it in GitHub Desktop.
Save anonymous/34897ea9039a2bce427d to your computer and use it in GitHub Desktop.
(ns test-project.foo
(:require [test-project.foo :refer :all]
[clojure.test :refer :all]))
(defmacro with-string-stream [var str & body]
`(let [~var (java.io.StringReader. ~str)]
(try ~@body
(finally (when s (.close s))))))
(with-string-stream s "Hello, world!"
(print (.read s)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment