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

Implemented GroupByMapValues #443

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

maryum375
Copy link

Implemented a new function to GroupBy.
This Implementation allows to map the values on the same iteration.
Sending an identity function as the iterateeValue will de facto result in a normal GroupBy operation.

Copy link
Owner

@samber samber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we need to think a little bit about the naming

your variant: map then group by

other cool variant I use in my own projects: map then group by then aggregate values

result := map[K][]V{}

for _, item := range arr {
k := iterateeKey(item)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use a single iteratee: k, v := iteratee(item)

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

Successfully merging this pull request may close these issues.

2 participants