> On Jan 2, 2018, at 11:57 PM, Ben Cohen <ben_co...@apple.com> wrote:
> 
> I think this is a perfect case for an addition to the existing Lazy suite 
> (and IMO would make a good evolution proposal too, as this kind of “chunked” 
> splitting is a useful feature). You’re right though, there isn’t a good guide 
> out there for how to do this (calling any intrepid blogger who wants to write 
> one…)
> 
> Here’s a sketch of how it would fit into lazy. This is with the latest 
> toolchain from master, which makes things a LOT easier now that IndexDistance 
> is dead. It’s slightly inefficient because it re-uses Index from Base for its 
> index, it would be more efficient to use a start/end pair for the chunks but 
> that’s a lot more code :)
> 
> What’s also interesting is you could (with conditional conformance now that’s 
> landed) make it a RandomAccessCollection if the base were random access, but 
> not if the base is bidirectional, because you need to be able to calculate 
> the size of the last element in constant time.

I got a trial at <https://github.com/CTMacUser/SectionedSequences>.

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com 

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to