On Jun 14, 4:37 am, Wrexsoul <d2387...@bsnow.net> wrote: > Seems to me that unless you completely consume the sequence, it will > leak a file handle.
That's true, but that's a problem that affects all seqs. There's no current way to mark a seq that comes from a stream as being discarded or closed, except by closing the initial stream. > OK. Even so, the implementation in terms of super-lazy-seq shows the > power of that macro. Mostly, I'm doing quite a few things with I/O > that require custom next-item-in-seq generators for the records or > other objects returned, for which it's coming in real handy. Okay, but don't underestimate the power of higher level functions. I don't know whether it would apply to your code, but the repeatedly function can be used to create a lazy seq from a function with side- effects. For example: (defn custom-lazy-seq [stream] (repeatedly #(next-item-in-seq stream))) - James --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---