Andy,

That's the "custom seq that closes the file..." I was referring to. I
guess I looking for a magical line-seq that closes the file correctly
even if you consume part of the sequence, is resilient to exceptions,
etc, etc. I realize that it might be impossible, so I asked. :)

Thanks,

Dave

On Fri, Oct 26, 2012 at 7:10 PM, Andy Fingerhut
<andy.finger...@gmail.com> wrote:
> Devin, did you mean read-line from the old clojure.contrib.io?
>
> http://clojuredocs.org/clojure_contrib/clojure.contrib.io/read-lines
>
> Click the "+" symbol next to "Source" to see source code, also available here:
>
> https://github.com/richhickey/clojure-contrib/blob/061f3d5b45657a89faa335ffa2bb80819f2e6918/src/main/clojure/clojure/contrib/io.clj#L302
>
> Andy
>
> On Oct 26, 2012, at 5:23 PM, Devin Walters wrote:
>
>> I usually wind up with the line-seq from old contrib. Could you be more 
>> clear about what isn't satisfying about that? For me it usually boils down 
>> to: it's unsatisfying that core line-seq doesn't do that by default.
>>
>> '(Devin Walters)
>>
>> On Oct 26, 2012, at 6:45 PM, Dave Ray <dave...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> At work I've had a few conversations about treating files, especially
>>> large ones, as seqs of lines. In particular, the apparent conflict
>>> between using clojure.core/with-open to ensure a file is closed
>>> appropriately, and clojure.core/line-seq as a generic sequence of
>>> lines which may be consumed by code that has no idea it's coming from
>>> a file. I've been told [1] that C# solves this problem because the
>>> IEnumerator interface is disposable so it's possible to clean up the
>>> underlying file, even if it's been wrapped in several layers of
>>> enumerators... and that since Clojure doesn't do this, it's flawed :)
>>>
>>> Thoughs? I'm aware of the "custom seq that closes the file when the
>>> end is reached" hack, but that doesn't seem very satisfying. How do
>>> others process large files in Clojure? Just make sure that the
>>> sequence is totally consumed within with-open? Just don't worry about
>>> closing files?
>>>
>>> Cheers,
>>>
>>> Dave
>>>
>>>
>>> [1] My C# experience is limited to a few days of writing example code
>>> for the C# bindings of a product's API. :)
>>>
>>> --
>>> 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
>>
>> --
>> 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
>
> --
> 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

-- 
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