Detection of One Sorted Sequence Being a Subset of Another#234
Open
CTMacUser wants to merge 9 commits intoapple:mainfrom
Open
Detection of One Sorted Sequence Being a Subset of Another#234CTMacUser wants to merge 9 commits intoapple:mainfrom
CTMacUser wants to merge 9 commits intoapple:mainfrom
Conversation
Add a function for a sequence that takes another sequence and a predicate, assumes that both sequences are sorted to that predicate, and checks if the argument sequence is a subset of the receiver. Add a function that takes the above function, but defaults the predicate to the less-than operator. Add tests and documentation.
Contributor
Author
|
I made a discussion thread. |
Change the overlap domain flags from a triplet of Boolean to a bit-masking integer. Make some variable names longer.
The changes to the return type in commit
ba38c7a
were not updated in the documentation
Change the 3 Boolean inputs in the `overlap` functions that control early exits to one value of a custom type. Add the custom type to the tests. Update the documentation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This function is an adaptation of the
includesfunction from C++. This pull request is a sequel to "Detection of How One Sorted Sequence Includes Another" (#38).I started with a new version of the
Inclusiontype and thesortedOverlapfunction from Pull #38. I added another function,includes, that calls the overlap detector then translates the exact overlap degree to a simpleBoolresult.Then I figured that no one actually cares about the precise overlapping factor. So the precise-overlap function and support type were removed, and its code was moved into
includesdirectly. Since a general answer wasn't required, I could add short-circuit logic.Detailed Design
One primary function extends
Sequenceto test if a given sequence is a subset of the receiver, assuming both are sorted according to the given predicate. (The given sequence's elements need not be contiguous in the receiver.) The variant function removes the predicate parameter for a default of the less-than operator (<), at the cost of requiringComparableconformance.Documentation Plan
Both introductory documentation and a guide were added.
Test Plan
A test file was added.
Source Impact
The functions are an additive change, not otherwise affecting the API.
Checklist