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

Dave Abrahams dabrahams at apple.com
Wed Apr 6 13:30:36 CDT 2016


on Wed Apr 06 2016, Stephen Canon <scanon-AT-apple.com> wrote:

>     On Apr 6, 2016, at 11:20 AM, Stephen Canon via swift-evolution
>     <swift-evolution at swift.org> wrote:
>
>         On Apr 6, 2016, at 11:16 AM, Dave Abrahams via swift-evolution
>         <swift-evolution at swift.org> wrote:
>
>         One question that I *do* think we should answer, is whether the elements
>         of
>
>         (0..<199).striding(by: -2)
>
>         are even or odd.
>
>     Odd. I don’t believe that many real use cases care, but odd is more
>     efficient from a performance perspective. Needs to be documented clearly,
>     however.
>
> Sorry, I was thinking of (0…199).striding(by: -2).
>
> For the (0..<199) case, Erica’s assessment 

which is...?

> seems about right, though it isn’t at all obvious how it generalizes
> to floating point strides.
>
> – Steve
>

-- 
Dave


More information about the swift-evolution mailing list