Following a discussion from a few days ago, I've added two new macros
to clojure.contrib.duck-streams:
(defmacro with-out-writer
"Opens a writer on f, binds it to *out*, and evalutes body."
[f & body]
`(with-open [stream# (writer ~f)]
(binding [*out* stream#]
~...@body)))
(defmacro with-in-reader
"Opens a PushbackReader on f, binds it to *in*, and evaluates body."
[f & body]
`(with-open [stream# (PushbackReader. (reader ~f))]
(binding [*in* stream#]
~...@body)))
-Stuart Sierra
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---