Thanks Stephen - that's helpful. Just a few more Qs:
In your example you have bs = (read-block-seq r), where "bs is a lazy seq of Java char arrays…" Does that imply that bs is an immutable seq? That I can reread - peek at the first chars without consuming? Also, can it be used with stdin? Can I use it for interactive input from a terminal until the user sends CTRL-D/EOF? -FrankS. On Dec 12, 2012, at 7:43 PM, Stephen Compall <stephen.comp...@gmail.com> wrote: > On Wed, 2012-12-12 at 18:41 -0800, Frank Siebenlist wrote: >> Could you give a few use cases that shows what your library can be used >> for? > > Sure; it is, after all, a little abstract. > > The library helps you separate I/O from pure, composable functions, > while retaining performance. It does for input streams what chunked > seqs do for lazy seqs. > > Say you have a text file f, let r = (reader f). > > Let bs = (read-block-seq r). bs is a lazy seq of Java char arrays, a > "block seq", each read from the stream as requested. > > Let s = (block-seq->seq bs). s is a seq of Java chars, still lazy, > efficiently represented by the input arrays in a chunked seq. > > Let lstr = (->char-array-seq-sequence bs). lstr is a Java CharSequence > (the base interface of strings), still lazily backed by the same > underlying seq of char arrays, complete with structural sharing on > subSequence. > > Now you can write pure functions on these structures at whatever level > is convenient for you, and as long as you do not close the stream before > you finish processing the input, it'll work out. > >> Is it only for those of us that require a stream/seq of single >> bytes/chars? > > I believe that criteria covers everyone :) > >> Would that make it easier to generate sha1's for example? >> Is it useful for sound/video-like streams? > > In both cases, I imagine so. > > -- > Stephen Compall > "^aCollection allSatisfy: [:each | aCondition]": less is better than > > -- 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