Publisher.zip completions23 Jan 2021 ⇐ Notes archive
(This is an entry in my technical notebook. There will likely be typos, mistakes, or wider logical leaps — the intent here is to “let others look over my shoulder while I figure things out.”)
Zipping — in general — is a pairwise affair.
zip is non-
nil if both arguments are. Similarly for
zip along the
Swift.zip pairs until it runs off the shorter of the sequence arguments.
Parsers.Take2 (another name for zipped parsing) succeeds if both parsers involved do.
A zipped publisher can complete even if all of its inner publishers don’t.
This checks out after a pause — since
second completes after the first
(1, 2) pair comes through, there’s no chance it’ll pair with any future value events from
first. Hence the completion. So, even though zipping is usually synonymous with “pairing” in my head, I’ll need to remember that doesn’t necessarily extend to completion events.