Closed Smoren closed 1 year ago
This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Totals | |
---|---|
Change from base Build 3993592557: | 0.0% |
Covered Lines: | 463 |
Relevant Lines: | 464 |
Thanks for the explanation and examples. From what I understand, a union of a multiset is really taking the item from the set that has the max cardinality, rather than "adding" them all together. Your examples show the same thing. Thanks.
OK. I'm glad that we have come to a common perception of this functionality.
You can merge this PR if you want to add the tests included in it.
BTW, I was very surprised that the concept of partial intersection was not defined in math. I consulted with mathematician friends and decided to write an article on this topic.
Thank you for the inspiration!
Hi @markrogoyski,
FYI: I've created a new repository with explanation and examples of the partial intersection.
Set::intersectionPartial()
test cases added for multisets with$minIntersectionCount = 1
.Explanation of the behavior:
For any N when M = 1 we have a union of sets or multisets.
Some examples of multiset unions from this article:
[1, 2] ∪ [1] = [1, 2]
;[1, 2] ∪ [1, 1] = [1, 1, 2]
;[1, 1] ∪ [1, 1, 1, 2] = [1, 1, 1, 2]
.I've added test cases for this examples and some more complicated cases. They all work predictably.