chunked(on:)

Returns a lazy collection of subsequences of this collection, chunked by grouping elements that project to equal values.

Chunked.swift:436
func chunked<Subject>(on projection: @escaping (Element) -> Subject) -> ChunkedOnCollection<Elements, Subject> where Subject : Equatable

Parameters

projection

A closure that takes an element in the sequence and returns an Equatable value that can be used to determine if adjacent elements belong in the same group.