What's best way in clojure to implement something like an actor or agent (asynchronously updated, uncoordinated reference) that does the following?

* gets sent messages/data
* executes some function on that data to obtain new state; something like `(fn [state new-msgs] ...)`
* continues to receive messages/data during that update
* once done with that update, runs the same update function against *all* messages that have been sent in the interim

An agent doesn't seem quite right here. One must simultaneously `send` function and data to agents, which doesn't leave room for a function which operates on *all* data that has come in during the last update. The goal implicitly requires a decoupling of function and data.

The actor model seems generally better suited in that there is a decoupling of function and data. However, all actor frameworks I'm aware of seem to assume each message sent will be processed separately. It's not clear how one would turn this on it's head without adding extra machinery. I know [Pulsar's](http://docs.paralleluniverse.co/pulsar/) actors accept a `:lifecycle-handle` function which can be used to make actors do "special tricks" but there isn't a lot of documentation around this so it's unclear whether the functionality would be helpful.

I *do* have a solution to this problem using agents, `core.async` channels, and `watch` functions, but it's a bit messy, and I'm hoping there is a better solution. I'll post it as a solution in case others find it helpful, but I'd like to see what other's come up with.