with-out-writer

clojure.contrib.io

  • (with-out-writer f & body)
Opens a writer on f, binds it to *out*, and evalutes body.
Anything printed within body will be written to f.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/io.clj:352 top

(defmacro with-out-writer
  "Opens a writer on f, binds it to *out*, and evalutes body.
  Anything printed within body will be written to f."
  [f & body]
  `(with-open [stream# (writer ~f)]
     (binding [*out* stream#]
       ~@body)))
Vars in clojure.contrib.io/with-out-writer: defmacro *out* apply binding concat list seq vector with-open
Used in 0 other vars

Comments top

No comments for with-out-writer. Log in to add a comment.