Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add concurrency option #4

Open
niftylettuce opened this issue Aug 1, 2020 · 3 comments
Open

Add concurrency option #4

niftylettuce opened this issue Aug 1, 2020 · 3 comments

Comments

@niftylettuce
Copy link

Similar to p-map, it would be nice to have this built-in rather than have to use p-limit for instance.

@fregante
Copy link

How would this even work? Reduce depends on the last value. If it doesn't, then why do you need reduce?

@septatrix
Copy link

How would this even work? Reduce depends on the last value. If it doesn't, then why do you need reduce?

One potential use-case would be when the values can be determined asynchronously and independent from each other. Currently this can mostly be archived with pMapIterable, however, that requires a for loop and thus cannot easily be used in e.g. an expression.

@septatrix
Copy link

Or in other words: pReduce should be able to accept not only Iterable<Promise|any> but also AsyncIterator<any>. This way one could write pReduce(pMapIterable(values, mapper), reducer, initialVal)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants