On Apr 28, 12:53 pm, Stuart Sierra <the.stuart.sie...@gmail.com>
wrote:
> clojure.contrib-duck-streams has a similar function, read-lines, that
> does close the Reader after all the lines have been read (and the
> sequence consumed).  It's not entirely safe, because if an exception
> or something prevents you from reading all the lines, the Reader
> remains open.
>
> -Stuart Sierra
I should have known contrib would have had something.  I need to read
the contrib sources more.  Thanks!

Brad

>
> On Apr 28, 1:01 pm, Bradbev <brad.beveri...@gmail.com> wrote:
>
> > Hello,
> > I want to use line-seq, and have it close the input reader.
> > My first attempt was
> > (with-open [stream (BufferedReader.)]
> > (line-seq stream))
> > Which crashes immediately because you can't read lines from a closed
> > seq.  So, the only way to explicitly close the reader associated with
> > line-seq is to keep another ref to it.
>
> > Is it a good idea for line-seq to close its BufferedReader when there
> > is no more data?  Or at least provide an optional parameter that
> > allows/disallows close?
>
> > Cheers,
> > Brad
--~--~---------~--~----~------------~-------~--~----~
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
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