The documentation of chunked(by:) states that the predicate is evaluated on consecutive elements. Experience and a naive look at the source are suggesting it is evaluated using the first element of the chunk instead of the previous one.
Steps to Reproduce
Let a: [Int] = [1,2,3,4,6,7,8,9] ("5" is missing). We want to chunk a such as two consecutive elements are consecutive numbers (their difference is exactly 1).
The documentation of
chunked(by:)
states that the predicate is evaluated on consecutive elements. Experience and a naive look at the source are suggesting it is evaluated using the first element of the chunk instead of the previous one.Steps to Reproduce
Let
a: [Int] = [1,2,3,4,6,7,8,9]
("5" is missing). We want to chunka
such as two consecutive elements are consecutive numbers (their difference is exactly 1).Expected behavior
Actual behavior
Am I understanding the documentation incorrectly, or is there an inconsistency between the documentation and the expected behavior?