Re: capturing stdout

2009-03-22 Thread Stuart Sierra
On Mar 22, 10:34 am, Mark Volkmann wrote: > (defn get-output [fn] >   (let [sw (StringWriter.)] >     (binding [*out* sw] (fn)) >     (.toString sw))) This is what clojure.core/with-out-str does. -Stuart Sierra --~--~-~--~~~---~--~~ You received this message beca

Re: capturing stdout

2009-03-22 Thread Mark Volkmann
Never mind. I think I needed to make this a macro instead of a function like this: (defmacro get-output [fn] `(let [sw# (StringWriter.)] (binding [*out* sw#] ~fn) (.toString sw#))) On Mar 22, 9:34 am, Mark Volkmann wrote: > I can't figure out why this function seems to work, but also