Hi,
As seen in this example of a stateful transducer...
http://crossclj.info/ns/org.clojure/clojure/latest/clojure.core.html#_partition-by
... I am wondering what is the concrete motivation behind using 'volatile!' instead of say a simple (mutable) Java-Object wrapper ?
In the partition-all example, an ArrayList is used for aggregating the 'temporary' results for the step-function, so this mutable state is not concerned with threading at all.
Why then is there a threading-concern with pv (the volatile!) ?
As far as I understand, the step-function of a transducer is never(?) accessed concurrently by more than 1 thread.
Is volatile! necessary because transducers should be usable with core.async ?
Or is it just an easy way to get a mutable object in Clojure ?
Best,
Joerg