Hmm. This is becoming something of a puzzle.

A simple noncode version of the model I am using is this

(loop
  (increase year with 1)
  (break and create bidirectional links between refs)
)

The break and create step represents a contact network between humans,
where each human is basically a struct-map which holds a list of other
humans s/he is currently connected to. These connections need to be
atomically broken and created, hence the refs. More details in the
chlam-clean.clj file, and the accompanying forum post.

To get this thing concurrent (i.e, using the multiple cpu's in my
machine) Timothy suggested (
http://groups.google.com/group/clojure/browse_thread/thread/13372bfe6bdd6497/0141cad632130799
) to use the future function. I'll be working on that coming monday,
but I was gathering some more information on how to use that future
function in the mean time.

(loop
  (increase year with 1)
  (concurrent: (break and create bidirectional links between refs))
  (wait for year to finish)
)

I'll try your suggestion and see if it is workable. Thanks!


On Feb 28, 10:35 am, Christophe Grand <christo...@cgrand.net> wrote:
> bOR_ a écrit :
>
> > can I call something like (apply await myvectorofrefs) if I have a
> > bunch of futures running and I want to wait for them to finish before
> > I go on with the next step in the model?
>
> No you can't use await. The simplest way to await for a future is to
> deref it: @fut blocks until the computation ends.
> Hence to await on a bunch of futures you can do:
>   (doseq [f futs] @f) or (dorun (map deref futs))
>
> But, since deref blocks, do you really need to await on them?
>
> Christophe
>
> --
> Professional:http://cgrand.net/(fr)
> On Clojure:http://clj-me.blogspot.com/(en)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to