-
Notifications
You must be signed in to change notification settings - Fork 303
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
Counted Set #20
Comments
Yep -- counted multisets are useful, and they would be an interesting API design exercise! I think an unordered counted multiset that stores its contents in a An ordered multiset would likely not be counting -- it would need to preserve duplicate items so that it can keep them in the desired order. This would be much like We already have plans to use the B-tree implementation that we develop in #1 to add a sorted multiset type. This too would keep duplicates as is, rather than counting them. |
Part of the API design challenge is to figure out how to expose the multiplicities while also keeping the interface familiar to Swift users. (SetAlgebra definitely can't handle multisets, but its high-level operations translate pretty well, I think.) API design-wise, I expect a counted multiset will have a very different interface than a dupe-preserving one. For example, would CountedUnorderedMultiset be a Collection? If so, what would be its Element type? |
As |
Hey all, if a Name TBD, but something like a This is more chainable, and substantially improves the code clarity. See this motivation for why |
How about a counted set/multiset type? These are pretty commonly used, and can be quite handy:
https://developer.apple.com/documentation/foundation/nscountedset
https://developer.apple.com/documentation/corefoundation/cfbag-s1l
The text was updated successfully, but these errors were encountered: