-
-
Notifications
You must be signed in to change notification settings - Fork 753
Implementations of takeWhile, drop, and dropWhile. #147
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
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ea576d0
Implemented takeWhile.
jmdavis 406e4d6
Implemented drop.
jmdavis a5b5eda
Added dropWhile.
jmdavis 8cea2e5
Some adjustments to std.range.drop.
jmdavis bcd2cfd
Made std.range.drop's Result struct static.
jmdavis 9114528
Fixed some items from review comments.
jmdavis bbed3d2
Added links between takeWhile and until in documentation.
jmdavis ec47424
Some improvements to drop's documentation.
jmdavis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
takeWhileanddropWhileshould be instd.algorithm. All functions instd.rangeeither modify a range by its structure (take,chain,zip, ...), or generates a range (recurrence,iota, ...), but none of them actually modify a range by its values.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm. Maybe. But with
takebeing in std.range, I'm ill-inclined to puttakeWhilein std.algorithm. Also,dropdefinitely fits better in std.range, and I'm ill-inclined to havedropWhilein a separate module for the same reason.Also,
takeWhileanddropWhiledon't modify a range anymore thantakeorchaindo. I don't understand the distinction that you're making.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jmdavis: The difference is that
takeWhileanddropWhiletake predicates. Anyway, this is just an observation.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it is true that for the most part the range-based functions which take predicates are in std.algorithm rather than std.range, but there are already some in there (albeit not many). But really, what should go in std.range or std.algorithm is a bit debatable. They're not really clearly delineated. I could easily see
takeWhileanddropWhilein std.algorithm (and there are already similar functions there - e.g.until), but I'd be more inclined to put them in std.range, becausetakeanddropare there. It could go either way though.