ChunksOfCountCollection

A collection that presents the elements of its base collection in SubSequence chunks of any given count.

Chunked.swift:533
struct ChunksOfCountCollection<Base> where Base : Collection

A ChunksOfCountCollection is a lazy view on the base Collection, but it does not implicitly confer laziness on algorithms applied to its result. In other words, for ordinary collections c:

  • c.chunks(ofCount: 3) does not create new storage

  • c.chunks(ofCount: 3).map(f) maps eagerly and returns a new array

  • c.lazy.chunks(ofCount: 3).map(f) maps lazily and returns a LazyMapCollection