Download Latest Version Swift Algorithms 1.2.1 source code.tar.gz (256.6 kB)
Email in envelope

Get an email when there's a new version of Swift Algorithms

Home / 1.2.0
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2023-11-15 941 Bytes
Swift Algorithms 1.2.0 source code.tar.gz 2023-11-15 248.1 kB
Swift Algorithms 1.2.0 source code.zip 2023-11-15 305.5 kB
Totals: 3 Items   554.5 kB 3

Additions

  • Sequences have new grouped(by:) and keyed(by:) methods, which simplify building dictionaries based on sequence elements: (#197)

```swift let evensOdds = (1...10).grouped(by: { $0.isMultiple(of: 2) ? "even" : "odd" }) // ["even": [2, 4, 6, 8, 10], "odd": [1, 3, 5, 7, 9]]

let animals = ["Aardvark", "Alpaca", "Armadillo", "Barracuda", "Buffalo", ...] let alphaAnimals = animals.keyed(by: .first!, resolvingConflictsWith: { _, first, _ in first }) // ["A": "Aardvark", "B": "Barracuda", ...] ```

  • The endOfPrefix(while:) and startOfSuffix(while) methods are now public. These methods were previously implementation details of the trimming group of methods. (#211)

Fixes

  • Documentation and performance improvements. (#202, [#210])

The 1.2.0 release includes contributions from @amomchilov, @mattyoung, @natecook1000, @stephentyrone, and @ttsugriy. Thank you!

Source: README.md, updated 2023-11-15