Hi Cecil,
On Apr 12, 2014, at 3:18 PM, Cecil Westerhof wrote:
>
> I just started playing with Clojure a few days ago, so I am a tabula rasa. I
> attached what I have until now. If it can be improved, I like to know it.
I had a look at your code and it's not clear to me what you are trying to
I took a look at the code, but it's not clear to me what it's supposed to
be doing.
But, my suspicion is this algorithm could be expressed as a reduce, which
means you could potentially use reducers on it and get fork/join
concurrency for free.
I think that's the case because it seems like these
2014-04-12 17:19 GMT+02:00 Gary Trakhman :
> I'd recommend running a doall on concurrent-list in order to realize the
> futures, if you simply deref as you are, then you're going to delay the
> execution of futures down the line as the sequence is realized bit by bit
> (except chunking helps you h
Also, 'doall' is a bad idea if the number of threads is large :-).
You might want more control over the threadpool at that point. Futures
uses
http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/Executors.html#newCachedThreadPool()
https://github.com/clojure/clojure/blob/master/src/clj
I'd recommend running a doall on concurrent-list in order to realize the
futures, if you simply deref as you are, then you're going to delay the
execution of futures down the line as the sequence is realized bit by bit
(except chunking helps you here by accident). You are effectively
preventing la
I first had the following function:
(defn check-concurrent2 []
(init "concurrent2")
(let [c1 (future (do-sequential 1 check-until 4))
c2 (future (do-sequential 2 check-until 4))
c3 (future (do-sequential 3 check-until 4))
c4 (future (do-sequential 4