Re: idiom question: infinite sequence as data source for many threads?

2010-02-01 Thread free_variation
Urp yes thanks! Remainder of a previous version of the function. jds On Feb 1, 3:57 pm, Daniel Werner wrote: > On Jan 30, 7:07 am, free_variation wrote: > > > (defn init-features [stream] > >         (let [feature-stream (ref stream)] > >                 (dosync (ref-s

Re: idiom question: infinite sequence as data source for many threads?

2010-01-31 Thread free_variation
Excellent, very nice. Mind if I use it? jds On Jan 30, 2:09 am, Timothy Pratley wrote: > Below I present 'submit-future' which is similar to the existing > 'future' call in that it spawns a thread to execute a task, but > differs in that it will block if n submitted futures are already > runnin

Re: idiom question: infinite sequence as data source for many threads?

2010-01-29 Thread free_variation
concise this is. I'm really loving Clojure! I kinda miss typing 'lambda' instead of 'fn' or '#(', but I suppose a macro can fix that. Must have been done already :) On Jan 29, 1:42 am, Meikel Brandmeyer wrote: > Hi, > > On Jan 29, 5:05 am, free_var

Re: idiom question: infinite sequence as data source for many threads?

2010-01-28 Thread free_variation
You people are terrific, thanks so much. I basically went with what Michal and Konrad worked out: (let [feature-stream (ref nil)] (defn init-features [stream] (dosync (ref-set feature-stream stream)) 'ready) (defn get-feature [] (dos

idiom question: infinite sequence as data source for many threads?

2010-01-27 Thread free_variation
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 ele