Hi,

I'm a clojure noob, with a background in scheme (and functional
languages).

I'm looking for the "clojure way" to solve the following problem:

I have an infinite sequence.  I'd like to have the sequence be a
source for N parallel worker threads that now and then will show up to
grab a few elements from the sequence, then go off and crunch on the
data.  The sequence should be traversed only once per execution of the
software.

I'm not clear on how to implement this without keeping a reference to
the sequence, say in a closure.  In scheme I might solve the problem
using a continuation.  But in clojure if I do, say:

(let [my-seq (....lazy-seq ...)]
    (defn get-some-data ...))

won't I run out of memory?  Is the solution to have my-seq somehow
refer to the next element to be retrieved, i.e. to the head of the
infinite sequence that has yet to be fed to the workers?

Thanks,

jds

-- 
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

Reply via email to