-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[SR-6691] Sequence.split should have a Lazy equivalent #49240
Comments
Comment by Daryle Walker (JIRA) It seems this bug may have been inspired by the blog post "Conditional Conformance in the Standard Library". On a Swift mailing-list thread, I had a conversation with the author over a similar class. In my final code, I wrote:
The blog only has something like the last one. But all four may be useful when porting to the standard library. (The first two types vend an Array of Element, the latter two SubSequence.) Edit: looking at the blog post again, I noticed that his example splits on a given separator value, while my code splits after a set count of elements. Edit 2: He does mention a chunking collection at the end of the blog post. |
Comment by Tapan Thaker (JIRA) CTMacUser (JIRA User) : Based on your comment shall I sure that you are working on this ? |
Comment by Daryle Walker (JIRA) I came up with the idea to help break up a Mac-specific collection (NSData), then for play. I wasn't thinking of it as a Swift standard library contribution. I don't know what to do here because I'm distracted by another Swift idea (which happens to me a lot). So, if you want to work on chunking (and/or splitting) yourself, go ahead. |
May i handle this issue? please assign to me, I'll work on it and create a pull request! |
@greenthings Please note that this feature needs a Swift evolution proposal. |
Ok, thank you. I'm going to make a proposal soon. |
FYI, @greenthings make swift-evolution proposal~ I really want this |
Hi, @AnthonyLatsis , @airspeedswift I have submitted a proposal for introducing lazy evaluation in Swift's Sequence. While the initial request was for implementing laziness in Sequence, I noticed that both Sequence and Collection could benefit from this feature. I'd appreciate guidance on whether I should create two separate proposals for 'Lazy Sequence' and 'Lazy Collection' or pursue a different approach." Proposal URL: |
Hi Jun, a single proposal is fine. I assume your proposal is not ready for official review yet. Please turn swiftlang/swift-evolution#2193 into a draft pull request until then. |
Additional Detail from JIRA
md5: 1e8d36124b9916625ca75e3f19b449dc
Issue Description:
Sequence.split
is eager, but if you are splitting a collection, it should be possible to do it lazily. This could be done via an extension toLazyCollectionProtocol
so you could write"a.b.c".lazy.split(separator: ".")
.The text was updated successfully, but these errors were encountered: