apple / swift-algorithms

Commonly used sequence and collection algorithms for Swift
Apache License 2.0
5.97k stars 443 forks source link

Ensure `chunked(by:)` always compares consecutive elements #162

Closed timvermeulen closed 3 years ago

timvermeulen commented 3 years ago

Fixes #161.

[a, b, c, d].chunked(by: { print($0, $1); return true })
// previous behavior: (a, b), (a, c), (a, d)
// correct behavior:  (a, b), (b, c), (c, d)

Checklist

timvermeulen commented 3 years ago

@swift-ci Please test