Skip to content

Add Enum.sum/2 #11455

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

Closed
wants to merge 1 commit into from
Closed

Conversation

hauleth
Copy link
Contributor

@hauleth hauleth commented Dec 7, 2021

The behaviour of new function is similar to map/2 followed by sum/1.

This behaves similarly to:

  • Enum.all?/2
  • Enum.any?/2
  • Enum.count/2
  • All *_by/2 functions

This should simplify a lot of cases when we want to sum values stored in nested manner like summing values in list of tuples, list of maps, or even in maps itself.

The behaviour of new function is similar to `map/2` followed by `sum/1`.

This behaves similarly to:

- `Enum.all?/2`
- `Enum.any?/2`
- `Enum.count/2`
- All `*_by/2` functions

This should simplify a lot of cases when we want to sum values stored in
nested manner like summing values in list of tuples, list of maps, or
even in maps itself.
@hauleth hauleth force-pushed the ft/add-sum-with-mapper branch from 3742b13 to 5e6602e Compare December 7, 2021 12:20
@v0idpwn
Copy link
Contributor

v0idpwn commented Dec 7, 2021

Related: #11381

@josevalim
Copy link
Member

Closed per the previous discussion. Thanks!

@josevalim josevalim closed this Dec 7, 2021
@hauleth hauleth mentioned this pull request Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants