Skip to content

Proposal for joined and joined(separator:) #180

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

Merged
merged 3 commits into from
Aug 4, 2022

Conversation

FranzBusch
Copy link
Member

@FranzBusch FranzBusch commented Jul 18, 2022

This adds a proposal for the joined and joined(separator:) algorithms

@phausler Could you check if there is anything missing. Also is it fine to have you as the author of the proposal since you implemented the algo?

Read the full proposal here

@FranzBusch FranzBusch requested a review from phausler July 18, 2022 09:15
@phausler
Copy link
Member

That looks fine to me, if you want to put it on the forums and manage the thread associated with feedback for it please feel free to post.

@FranzBusch FranzBusch force-pushed the fb-joined-proposal branch from ebfd880 to e433e05 Compare July 19, 2022 09:47
@twittemb
Copy link
Contributor

Hi,

What is the difference between joined and flatMap { $0 } ?

@kperryua
Copy link
Member

What is the difference between joined and flatMap { $0 } ?

They're semantically identical. However the theory is that knowing in advance that the incoming element is already an AsyncSequence and that no transformation will be happening on it will allow for a more optimized implementation.

It's worth noting that the stdlib also has both joined() and flatMap() on Sequence, although perhaps for different reasons than we do here. Sequence.joined() returns a FlattenSequence which lazily enumerates the constituent sequences, while flatMap() does so greedily.

@phausler phausler merged commit b92ba05 into apple:main Aug 4, 2022
@FranzBusch FranzBusch deleted the fb-joined-proposal branch October 26, 2022 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants