Swift Algorithms 1.1.0
Additions
-
New nonmutating
partitioned(by:)
methods that return both the failing and passing elements of a sequence or collection in separate arrays. (#152)let cast = ["Vivien", "Marlon", "Kim", "Karl"] let (longNames, shortNames) = cast.partitioned(by: { $0.count < 5 }) print(longNames) // Prints "["Vivien", "Marlon"]" print(shortNames) // Prints "["Kim", "Karl"]"
-
A new
evenlyChunked(in:)
method that chunks a sequence or collection into the specified number of evenly-sized subsequences. (#96)let numbers = Array(0..<10) for chunk in numbers.evenlyChunked(in: 4) { print(chunk) } // Prints: // [0, 1, 2] // [3, 4, 5] // [6, 7] // [8, 9]
Changes
- The package now has a minimum Swift version of Swift 5.4.
Fixes
- Improvements to documentation, including a new DocC-based documentation structure.
The 1.1.0 release includes contributions from @dickoff, @gwynne, @mdznr, @natecook1000, @ole, @stephentyrone, and @timvermeulen.
Thank you!