On Mon, Feb 7, 2011 at 10:18 PM, Benny Tsai <benny.t...@gmail.com> wrote: > The blip.tv video of Tom Faulhaber's "Lisp, Functional Programming, > and the State of Flow" talk from Clojure Conj showed me 'fill-queue', > which seems like a good fit here. > > 'fill-queue' is a way to turn input from any source into a lazy > sequence. You give it a one-arg function, 'filler-func', which will > be called with an argument 'fill' in a separate thread. 'filler-func' > is expected to use 'fill' to push input onto a queue. 'fill-queue' > returns a lazy sequence of inputs pushed by 'filler-func', and will > block when needed.
That's a producer-consumer queue. I wrote something similar and posted it here recently. It also occurs to me that you can use (map char (take-while #(not= % -1) (repeatedly #(.read input-stream)))) as lazy-input. > Ken's nifty 'take-until-subseq'. Thanks. :) -- 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