ramda-adjunct icon indicating copy to clipboard operation
ramda-adjunct copied to clipboard

reduceK, reduceRightK

Open char0n opened this issue 7 years ago • 2 comments

Is your feature request related to a problem? Please describe. Kleisli reduction support (left nad right). In order for this to work the types being reduced must implement Chain specification. The iterator function receives two values: (acc, value). It may use R.reduced to shortcut the iteration.reduceRightK is similar to reduceK, except moves through the input list from the right to the left. The arguments' order of reduceRightK's iterator function is (value, acc).

Describe the solution you'd like

const listF = [Future.of(1), Future.of(2)];

const left = reduceK(R.add, Future.of(0), listF); // => Future(3)
const right = reduceRightK(R.add, Future.of(0), listF); //=> Future(3)

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

Kleisli reduction support.

const listF = [Future.of(1), Future.of(2)];

const reducedF = reduceK(add, Future.of(0), listF); // => Future(3)

char0n avatar Aug 01 '17 21:08 char0n

Yes this is going to be possible to implement.

char0n avatar Aug 23 '17 15:08 char0n

This is so exotic that I'm going to put it on hold until there is somebody else that really needs it.

char0n avatar Dec 24 '19 14:12 char0n