[swift-evolution] Feature proposal: Range operator with step

Milos Rankovic milos at milos-and-slavica.net
Wed Apr 6 13:10:25 CDT 2016

> On 6 Apr 2016, at 18:57, Xiaodi Wu via swift-evolution <swift-evolution at swift.org> wrote:
> Meanwhile, I was trying to talk about something like `stride(from: 200, to: 0, by: -2)`, which is easily expressed today but isn't straightforward at all to preserve with only ranges.

Precisely because the free function is also range-free, the sign of the step need not repeat the direction intent which is already indicated with `from: 200, to: 0`. In other words, I think this is much more intuitive:

     `stride(from: 200, to: 0, by: 2)`

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160406/a43f52b1/attachment.html>

More information about the swift-evolution mailing list