If on the *println* you don't see the value updated, it's probably because 
the operation sent to the agent wasn't applied yet.

Add a *(Thread/sleep 500)* in between the *send *and *println *expressions 
and you'll see the expected agents'.

Cheers,

JF   

On Wednesday, August 21, 2013 12:21:59 AM UTC+1, Kuba Roth wrote:
>
> Hi there,
> I've got a range of values and I'd like to run agents for each value per 
> thread. For some reason I've got only one agents being updated. 
> Not sure what's wrong here but I suspect  must be doing something terrible 
> stupid... 
>
> Thanks!
>
> (doseq [s (range 30 35)]
>        ;(println (format "_%s" s))
>        (intern *ns* (symbol (format "_%s" s) ) (agent s))         ;; set 
> initial value
>        (send @(intern *ns* (symbol (format "_%s" s))) + 100)      ;; send 
> agent and update value
>        (println @(intern *ns* (symbol (format "_%s" s)) ))        ;; deref
>  )
>

-- 
-- 
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