Create a writer from writer-spec, run the monadic I/O statement
on it, and close the writer. writer-spec can be any object accepted
by clojure.contrib.io/writer.
(defn with-writer
"Create a writer from writer-spec, run the monadic I/O statement
on it, and close the writer. writer-spec can be any object accepted
by clojure.contrib.io/writer."
[writer-spec statement]
(with-open [w (writer writer-spec)]
(first (statement (lock w)))))
Comments top
No comments for with-writer. Log in to add a comment.