Skip to content

Instantly share code, notes, and snippets.

@hiredman
Created September 24, 2009 00:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiredman/192389 to your computer and use it in GitHub Desktop.
Save hiredman/192389 to your computer and use it in GitHub Desktop.
(defn action [agent fn args solo?]
(proxy [clojure.lang.AAction] [agent fn args solo?]
(execute [] (prn :foo))))
(defn faux-agent [action-maker init]
(proxy [clojure.lang.Agent] [init]
(getAction [fn args solo?]
(action-maker this fn args solo?))))
;;repl
user=> (faux-agent action 1)
#<Agent$0@1947496: 1>
user=> (send-off *1 inc)
:foo
#<Agent$0@1947496: 1>
user=>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment