If `session` returns a list, why don't you just do `(take 5 (repeatedly session))` ??? with regards to concurrency I am not sure what you're asking...you want to do the same thing from multiple threads and accumulate a global result?

Jim


On 10/02/14 18:46, Haim Ashkenazi wrote:
Hi

I have a simple code that generates a list of maps:

(defn test-data
[nsamples]
  (loop [acc []]
    (if (>= (count acc) nsamples)
      acc
      (recur (concat acc (session))))))

The session function returns a list of one to five generated maps. The idea is to get a list of (not much more then) nsamples generated maps. This code runs fairly fast for my needs but out of curiosity I was wondering how would I make it run concurrently?

Thanks in advance
--
Haim
--
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
---
You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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
--- You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to