On Tue, Jul 29, 2008 at 6:46 AM, Brian Watkins <Wild...@gmail.com> wrote:
Is there an idiomatic way to use a seq as a queue? I'd like to have a
seq and be able to append items to it that would appear after the
items presently in it (or possibly still to be lazily generated). It
would be nice to be able to append other seqs also.
Have you checked out the seque function? It's in boot.clj but apparently
hasn't made its way up onto the API reference yet. I've included the doc
below. If you find a way to append into the lazy part of the original seq
you'd be good to go.
user=> (doc seque)
([s] [n-or-q s])
Creates a queued seq on another (presumably lazy) seq s. The queued
seq will produce a concrete seq in the background, and can get up to
n items ahead of the consumer. n-or-q can be an integer n buffer
size, or an instance of java.util.concurrent BlockingQueue. Note
that reading from a seque can block if the reader gets ahead of the