[swift-evolution] [Discussion] stride behavior and a little bit of a call-back to digital numbers
Erica Sadun
erica at ericasadun.com
Sat Feb 27 17:36:41 CST 2016
> The documentation is a bit weird. "It returns the sequence where last is less than or equal to `end`.” seems to tacitly assume that we’re talking about the longest possible sequence with that property. With your proposed "It returns the sequence where last is greater than or equal to `end`?” we’re now talking about the shortest possible sequence with that property.
>
> But what do you mean “no change for integers”? What about 1.stride(through: 10, by: 8)? Wouldn’t that return [1, 9] now and [1, 9, 17] with your change?
It means, I'm wrong about that. Fixing here, both in code and in text: https://gist.github.com/erica/03c398c06f6c47824429
print(Array(1.stride(through: 10, by: 8)))
[1, 9]
print(Array(1.stride(through2: 10, by: 8))) // my test implementation
[1, 9, 17]
The second progress now goes *through* 10.
-- E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160227/33ed9358/attachment.html>
More information about the swift-evolution
mailing list