what is the best way to bind vars to a value when sending to an agent?
I don't know if it's the best way but it's mine:
"Capture the current value of the specified vars and rebind
them on the agent thread before executing the action."
[vars agent action & args]
(let [locals (map #(gensym (name %)) vars)]
`(let [~@(interleave locals vars)
action# (fn [& args#]
(binding [~@(interleave vars locals)]
(apply ~action args#)))]
(send ~agent action# ~@args))))
(capture-and-send [*out*] a f b c)
I post it here because erohtar needed it, I needed it once so others may need it.