If you have a transducer chain that makes a stream of strings, you might want to accumulate them at the end into a string. Existing functions like str
will generate a lot of overhead as there is no stateful accumulator you can maintain.
What you really want is a StringBuilder that accumulates, and emits the string at finalization.
String joining could then be something like:
(transduce (interpose ",") str! coll)
extensible with more transducers as needed.
cgrand's xforms lib has something like this: https://github.com/cgrand/xforms/blob/2079b74271b858b6a91dcb87bc58f3b93ea0b19c/src/net/cgrand/xforms/rfs.cljc#L145-L147