开发者

Actors in Clojure

开发者 https://www.devze.com 2023-02-04 05:49 出处:网络
I am writing a utility in开发者_StackOverflow中文版 Scala that includes a \"file copy\" actor. I send file names to be copied and the actor does them one at a time.

I am writing a utility in开发者_StackOverflow中文版 Scala that includes a "file copy" actor. I send file names to be copied and the actor does them one at a time.

How would I to do the same thing in Clojure using agents?


Why you need to perform this using agents? because you want to copy them asynchronously? But if you still want to do this, you can use something like:

(do-all (for [x file-names] (send-off agent-name copy-function x)))

although, maybe it's better to use futures?

0

精彩评论

暂无评论...
验证码 换一张
取 消