[swift-evolution] [Pitch] Remove destructive consumption from Sequence

Brent Royal-Gordon brent at architechies.com
Fri Jul 1 05:57:11 CDT 2016


> On Jul 1, 2016, at 12:34 AM, Haravikk <swift-evolution at haravikk.me> wrote:
> 
> Sequences are currently dead easy to implement, and to implement in an ad-hoc way via AnySequence(body:), how would that be done under this required indexing scheme?

`sequence(state:next:)` could be adapted into a possibly-infinite `Collection`, and it's not much more difficult to use than `AnySequence`. (Although it would be more efficient to use a custom iterator for it than it would be to iterate with its indices.)

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list