On Tue, Dec 13, 2011 at 11:12 PM, Simone Mosciatti <mweb....@gmail.com> wrote:
> Ok, now by now i think to have understand...
>
> To do right, I should build a macro similar to let where I pass the
> filename and after execute the body close the stream, right ?

Easier to just use the pre-existing one: with-open.

Something like:

(with-open [rdr (clojure.java.io/reader foo)]
  (reduce something (filter whatever (transmogrify (lazy-reader rdr)))))

will auto-close rdr after the reduction is done, and evaluate to the
result of the reduction.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to