-
Notifications
You must be signed in to change notification settings - Fork 18k
proposal: maps: add Diff, Intersect, CopyFunc, Filter funcs #68480
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
Comments
Related Issues and Documentation (Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.) |
How is Merge different from Copy? |
You're right, they're the same, I think we can keep MergeFunc, but replace it with CopyFunc so we can resolve key conflicts |
See the discussion for a generic set type: #47331 (possibly to be revived soon once iterators land in the next version, as that's what stalled the original discussion) I also wrote https://pkg.go.dev/github.com/jimmyfrasche/mapset for doing set like things with regular maps |
|
The most important and useful are |
I'm not saying that |
The first thing that I thought when reading the title was how will you compare the values. |
the filter allows you to filter only based on value, this one will also provide you |
We can add value checking as well, if key is not found or values are diff, then append it to result map |
|
You're right, I missed it. so I think I can implement Diff and Intersect |
How will you compare the values? Or will you restrict the type constraint of |
I see only this way for this |
I want to propose adding new functions to the maps package:
I'll be happy to contribute a PR with tests if this is a good idea.
The text was updated successfully, but these errors were encountered: