Any Combine experts out there? Is the example on this page correct?

https://developer.apple.com/documentation/combine/publisher/zip(_:)

My naïve understanding would be that, as soon as I feed in an "A", it would output A1, but somehow it waits to output anything until *another* number is input?

Is that because it only checks for new values on the number publisher, and lettersPub has no clue it's being zipped?

#swiftlang #combine #publishers

zip(_:) | Apple Developer Documentation

Combines elements from another publisher and deliver pairs of elements as tuples.

Apple Developer Documentation
@uliwitness It's almost right. The output is what they say, but the (1, A) is printed on the third line, not the fourth.

@uliwitness zip is tuple-ing the outputs of the publishers. So an element is never repeated from tuple to tuple; both publishers have to send a new value for a new tuple to be emitted.

If you want a new tuple whenever *either* publisher changes (ie allowing repeated values) then use combineLatest()

@uliwitness the lettersPub does kinda know because it has no demand applied to it from the zip’s subscription. It is a common misconception that Combine is push based, in fact it is 100% pull based upon demand, modulo some bugs.