Reductions does not currently provide a transducer when called with a 1-arity.
Proposed:
A reductions transducer with explicit initialization values: reductions-with
Do to arity conflicts, this is a separate function, not combined with reductions
A second patch proposes a variant which allows explicit initialization values: reductions-with
Patch: 0003-add-reductions-with.patch
Prescreened by: Alex Miller
@alexmiller, any additonal insight into wether this has a chance of going in or if I can adapt/perfect the code in any way?
I will try to prescreen it when I get a chance.
I think I prefer the reductions-with approach rather than overloading into reductions.
You have two derefs @state - this is not wrong given the assumptions we are making here, but I think it would be stylistically preferred to see a single deref of state in a let.
Hi @alexmiller, It does make more sense to only have reductions-with, with a consistent behavior.
I've added a third patch which implements it according to your recommendations, avoiding the double deref.
Comment made by: sickill
FYI, I've used reductions-with from the 3rd patch by Pierre-Yves in my ClojureScript project and it worked out of the box without any adjustments.