-
Notifications
You must be signed in to change notification settings - Fork 441
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
Merging Two Sorted Sequences, Attempt 3 #236
Open
CTMacUser
wants to merge
34
commits into
apple:main
Choose a base branch
from
CTMacUser:merge3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
Add initializers to RangeReplaceableCollection that merge two sorted sequence arguments. Add a function returning a lazy sequence that can merge two other sorted sequences. Add initializers to RangeReplaceableCollection that treat their two sorted sequence arguments as sets, then generates a result of the given set operation. These are included since they use the same base splicing code as straight mergers. Add support types for mergers and set operations. One describes the specific set operation requested, including a straight merger. The others are a sequence that lazily generates a set operation or merger, and its corresponding iterator. TODO: Add tests and a guide.
Add methods to MutableCollection that merge two sorted partitions within the same collection. TODO: Add tests and a guide.
The set-operation initializers made everything more convoluted versus using a subset parameter in the base initializer.
Change the code for the prime eager merger function to reuse the base sequence and iterator easier. This mandated that the merger sequence object had to accept throwing predicates. This change is internal and users cannot exploit it.
Since the filter type's values model future changes, change the tense of its description from past to future. Correct some items' publicity, hiding internal details.
Add methods to MutableCollection that merge two sorted partitions within the same collection, but not requiring extra scratch space.
Remove references to deleted initializers. Add references to the in-place partition-merging functions.
Also include a test for the code that appears in the new Guide.
Change the set-operation merger sequence to make its lazy status conditional.
Correct a copy-and-paste error, where the some original functions' decreased capabilities were not updated. (Those capabilities stayed in the functions' copies.) Mark all the functions above as not eagerly generating their results. These functions' results don't actually conform to being a lazy sequence unless both source sequences also are lazy.
Change the general list of functions and the descriptions of the merging functions to reflect the split between the merge-only and subsetting variants.
Change the detailed design to accommodate for the split between the full versus subsetting merger functions.
Remove the quick partition-merge functions. Move the lower-memory partition-merge functions to their own file. Rename the functions, lessening the amount of "sort" in the labeling. Replace the general throw markers with exact-error markers. Make the corresponding changes to the tests.
Remove initializer-based merging. Replace and rename all the free functions and their support sequence/iterator types. Adjust the documentation and testing to match. Remove filter-less merging. Rename all the (lazy) free functions and their support sequence and iterator types. Replace the merging initializers with (eager) free functions.
Remove the parameter to specify the return type of eager mergers; they now are locked to being of the standard Array type. As this gives the eager merging functions the same name as the lazy versions, the lazy versions have been renamed to avoid ambiguity.
The sequence to merge other sequences needs to specify the ordering predicate's error type. But public use of that name never needs that error type. Rename the merging sequence to a un-public name. Add an alias from that un-public name to the old public name but removing the error type.
Naveen-C-Ramachandrappa
approved these changes
Oct 3, 2024
can you please update PR with the base branch? |
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 is a successor to #184, which succeeded #43. Should fix #192.
This library adapts the C++ functions
merge
andinplace_merge
.This library also adapts the C++ functions
set_union
,set_intersection
,set_difference
, andset_symmetric_difference
. (They share the same internal implementation asmerge
.)The main changes are:
RangeReplaceableCollection
. Lazy merging still uses a free function, which was renamed.MutableCollection
. One version uses extra space to work faster, the other goes in-place to save space.Detailed Design
The library composes of:
Documentation Plan
A simple breakdown list and a guide have been provided.
Test Plan
A test file has been provided.
Source Impact
The changes should be additive.
Checklist