Not sure what's going on with shutdown-agents, but you could call (run!
deref ...) to wait for all the futures to complete.

On Sat, May 19, 2018 at 3:29 PM Renata Soares <renata.sd...@gmail.com>
wrote:

> Hello,
>
> I am using future this way:
>
> (doall (map #(future (<passing the function here>)  (range 1 max-size))))))
>
> When the max-size is small like around 6, if I don't print (println (doall
> (map #(future (<passing the function here>)  (range 1 max-size))))))), the
> result <ranking> becomes empty
>
> (Without print)
>
> renata@renata:~/$ lein run
> ranking  {}
>
> (With print)
> renata@renata:~/$$ lein run
> (#object[clojure.core$future_call$reify__6962 0x6492fab5 {:status :ready,
> :val {:2 0, :4 0.0, :5 0, :1 2.5}}]
> #object[clojure.core$future_call$reify__6962 0x2c532cd8 {:status :ready,
> :val {:2 0}}] #object[clojure.core$future_call$reify__6962 0x294e5088
> {:status :ready, :val {:2 0, :4 0.0, :5 0, :1 2.5, :3 1.0}}]
> #object[clojure.core$future_call$reify__6962 0x51972dc7 {:status :ready,
> :val {:2 0, :4 0.0}}] #object[clojure.core$future_call$reify__6962
> 0x3700ec9c {:status :ready, :val {:2 0, :4 0.0, :5 0}}])
> ranking  {"1":2.5,"3":1.0,"5":0,"4":0.0,"2":0}
>
> I am using (shutdown-agents) after the doall...
>
> Any ideas why? I think it is because the futures aren't ready when
> (shutdown-agents) executes.
>
> (When the max-size is big, run normally)
>
> There is a way that I can wait for print the result until all futures are
> ready?
>
> Thanks!
>
> --
> 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/d/optout.
>

-- 
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/d/optout.

Reply via email to