on Thu Feb 02 2017, Jonathan Hull <jhull-AT-gbis.com> wrote: > Just out of curiosity, what are the use-cases for an infinite sequence > (as opposed to a sequence which is bounded to the type’s representable > values)?
1. The type may not have an inherent expressible bound (see BigInt, UnsafePointer, and *many* real-life Index types). 2. I keep repeating variants of this example: func listElements< S: Sequence, N: Number >(of s: S, numberedFrom start: N) { for (n, e) in zip(start..., s) { print("\(n). \(e)") } } which avoids incorrect behavior when N turns out to be a type that can't represent values high enough to list everything in s—**if and only if** `start...` is an unbounded range, rather than one that implicitly gets its upper bound from its type. -- -Dave _______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution