Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSwiftgenerics and constraintsSingle-choice MCQ

What does this generic function's constraint guarantee, and why is the `==` (same-type) constraint needed rather than just two separate `Sequence` constraints?

func zipMatch<S1: Sequence, S2: Sequence>( _ a: S1, _ b: S2 ) -> Bool where S1.Element == S2.Element, S1.Element: Equatable { Array(a) == Array(b) }