Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Actors in Clojure

Tags:

clojure

actor

I am writing a utility in 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?

like image 876
Ralph Avatar asked Nov 05 '22 04:11

Ralph


1 Answers

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?

like image 180
Alex Ott Avatar answered Nov 11 '22 08:11

Alex Ott