Question

Is there something equivalent to Python's StingIO for Clojure?

I'm trying to write a report generating/literate programming system similar to Sweave and Pweave for Clojure. I'm currently using a temp file, but I'd prefer using something similar to StringIO.

Was it helpful?

Solution

with-out-str is pretty handy.

(let [foo (with-out-str (println "Hello world!"))] 
   foo)

More documentation here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top