ramda-adjunct
ramda-adjunct copied to clipboard
reduceK, reduceRightK
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)
Yes this is going to be possible to implement.
This is so exotic that I'm going to put it on hold until there is somebody else that really needs it.