Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Clojure's concurrent agents in action (alexcollins.org)
39 points by spoon16 on July 29, 2012 | hide | past | favorite | 3 comments


send should never be used in a function that will not keep the CPU busy, such as one that calls Thread/sleep. send-off, which will allocate a new thread rather than taking up a slot in Clojure's fixed-size agent thread pool, should be used instead.


It's fine if you're just using it to simulate a computationally expensive operation, as he is here. In fact, in that case, it's slightly more realistic.


Another great tool in the Programmer tool kit. If you wanted this same concept on Scala or Java I recommend Akka2

http://doc.akka.io/docs/akka/2.0.2/scala/agents.html




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: