-
Notifications
You must be signed in to change notification settings - Fork 442
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
Add joined(by:)
#138
Add joined(by:)
#138
Conversation
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.
Top notch work!
So much great stuff here, which I'm sure we'll be able to mine for future additions!
Sources/Algorithms/Intersperse.swift
Outdated
} | ||
|
||
extension InterspersedMap: Sequence { | ||
public struct Iterator: IteratorProtocol { |
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 assume this public
access control is accidental?
public struct Iterator: IteratorProtocol { | |
internal struct Iterator: IteratorProtocol { |
Sources/Algorithms/Intersperse.swift
Outdated
} | ||
|
||
@inlinable | ||
public mutating func next() -> Result? { |
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.
public mutating func next() -> Result? { | |
internal mutating func next() -> Result? { |
Sources/Algorithms/Intersperse.swift
Outdated
} | ||
|
||
@inlinable | ||
public func makeIterator() -> Iterator { |
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.
public func makeIterator() -> Iterator { | |
internal func makeIterator() -> Iterator { |
} | ||
|
||
extension EitherSequence: Sequence { | ||
public struct Iterator: IteratorProtocol { |
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.
Since enum decl is internal, this may also be internal too?
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.
Looks great, @timvermeulen! 🎉
@swift-ci Please test |
This PR adds 4 ways of joining sequences of sequences with a separator, two of which let you base the separator on the sequences right before and after it:
Also adds the following building blocks internally:
Either
andEitherSequence
FlattenCollection
that flattens a collection of collections without separatorsInterspersedMap
that maps the sequence's elements and intersperses them with new elements at the same timeChecklist