I have released a library for fusing a stream, decoder, and resource 
management into a reducible object with the intent to automatically manage 
resources. You can then apply a transducer to this object. This means you 
can apply a transducer pipeline that only partially consumes the stream, 
yet will close the stream nonetheless.

You can also use this object as a sequence, though in that case it will 
load the entire decoded sequence into memory at the same time. There's a 
big difference between `(into [] (take 1) (decode-edn! stream))` and `(take 
1 (decode-edn! stream))`.

The library is called pjstadig/reducible-stream, and is at 
https://github.com/pjstadig/reducible-stream/

There is also a blog post covering the concepts: 
http://paul.stadig.name/2016/08/reducible-streams.html

I hope others find this useful. It's somewhat experimental, so caveat 
emptor. I welcome feedback.


Cheers!
Paul

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to