Provide a transducer for reductions

Description

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

Environment

None

Activity

Show:
import
October 1, 2017, 6:11 PM

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.

Pierre-Yves Ritschard
August 4, 2017, 8:43 AM

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.

Alex Miller
August 3, 2017, 9:02 PM

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.

Alex Miller
June 7, 2017, 3:30 PM

I will try to prescreen it when I get a chance.

Pierre-Yves Ritschard
June 7, 2017, 3:03 PM

@alexmiller, any additonal insight into wether this has a chance of going in or if I can adapt/perfect the code in any way?

Your pinned fields
Click on the next to a field label to start pinning.

Assignee

Unassigned

Reporter

Pierre-Yves Ritschard

Labels

Approval

Prescreened

Patch

Code and Test

Priority

Major

Affects versions