> Max Moiseev wrote:
> 
> FWIW, the ‘classical’ way of doing what I think you’re trying to do is:
> 
> extension Sequence {
>  var pairs: AnySequence<(Iterator.Element, Iterator.Element)> {
>    return AnySequence(zip(self, self.dropFirst()))
>  }
> }
> 
> Does it have the right behavior?

It doesn't if the sequence is single-pass or if iterating over it multiple 
times has other unwanted side-effects.

— Pyry

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to