Hi all, I finished porting my model to clojure, and am now trying to get it to run concurrently. During the porting I already to care to wrap the main functions (birth [loc], death [loc] etc) in dosyncs, and all the slots in the world-vector are refs.
I've the feeling those are all fine, and I am doing something wrong in starting the whole machinery. In the below code, I (hope that I) am sending off a list of instructions to each position in the world in such a way that the instructions can be processed concurrently. However, it seems like dotimes is waiting for the send-off agent to have finished before sending off another one. I think I know this because when I introduce side-effects (println) into the birth, death etc functions, the side-effects are fully in order both on the popsize level and within an agent. Can anyone tell me what mistake I am making? (time (do (dotimes i popsize (send-off (agent i) (doseq a [birth death infect infect evolve evolve evolve evolve evolve] (a i)))) (println "We've send off the whole population") (dosync (commute year inc)))) -> output of the model. trying evolution of 997 trying evolution of 997 trying evolution of 997 trying birth of 998 trying infection by 998 trying infection by 998 trying evolution of 998 trying evolution of 998 trying evolution of 998 trying evolution of 998 trying evolution of 998 trying birth of 999 trying infection by 999 trying infection by 999 trying evolution of 999 trying evolution --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---