I've been using core.async for some time, but avoided pub
and mult
, since I can't really grasp a useful usecase from their documentation.
Specifically what's the purpose of the topic-fn
and how would you use it in practice?
Or maybe you can map a theoretical explanation onto the following fictive approach. I think this could help a lot to see how it works in practice (if applicable at all?)
Fictive approach explained:
There would be several different views to represent the state. To let them act and respond to state-changes, I would like to have several channels (on an application level), which are - for example - dedicated to state-changes and user-inputs (like key presses).
Each of the views should be able to sub(scribe) ? to this application channel, so they can react independently to changes. Also each of the views should be possible to put
something on the state-channel (but not the user-input-chan).