2 ms·
Swift.String is composed of a finite set of symbols, with a finite maximum length. How can you create an infinite number of these? The article ignores the dis
by ken 8y ago
Swift.String is composed of a finite set of symbols, with a finite maximum length. How can you create an infinite number of these?
The article ignores the distinction in many places, but "String" in a Swift function means "the Swift.String type", not "an abstract string type like those used to represent Turing machine state".
- timjver 8y agoYou're not wrong, but the author's code does in no way rely on the fact that you could theoretically iterate over all the valid Int values in Swift, so it would have made no difference if the Int type was somehow truly infinite. And the author clearly acknowledges this: >it’s best to think of Int as modeling the infinite set of all integers