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

Xiaodi Wu xiaodi.wu at gmail.com
Thu Apr 7 18:37:38 CDT 2016


Conceptually, maybe? But of course the sequence is lazily evaluated, so the
only state stored in an instance of StrideTo is one value for the current
iteration; all the other properties in a StrideTo are just the inputs to
the stride function, and no length is computed let alone stored. I get that
you want something that represents the input instead of the output, but
what do you gain from that type not achievable otherwise?
On Thu, Apr 7, 2016 at 6:59 PM Brent Royal-Gordon <brent at architechies.com>
wrote:

> > I'm confused. There is an instance owning the start and end. It's called
> StrideTo or StrideThrough, conforms to Sequence (with a FIXME comment that
> it should conform to Collection) and is distinct from Range and from the
> Strideable bounds themselves. Is that different from what you're describing?
>
> Yes, it is different. StrideTo and StrideThrough represent the sequence
> resulting from the striding operation. If there was only one of them, you
> would probably call it StrideSequence. They are the *result* of the
> `stride` function or `striding` method.
>
> What I'm talking about is a single instance which represents what you are
> striding *over*, but *not* the length of the stride. It is an *input* to
> the `stride` function or `striding` method.
>
> Does that make sense?
>
> --
> Brent Royal-Gordon
> Architechies
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160407/15ee7c2b/attachment.html>


More information about the swift-evolution mailing list