One practical implication of treating Sequence as infinite is in lazy 
filter. If you pass Sequence, but not Collection, to lazy filter, it will 
guarantee to iterate it only once. If it's a collection, it will feel free 
to iterate it twice.

So one benefit of single-pass sequences is assumptions about behaviour of 
an API: if it can work with sequences, then it will only iterate them 
once.

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

Reply via email to