Swift Algorithms is a library of sequence and collection algorithms for Swift, providing operations for splitting, cycling, combining, and sampling collections with lazy evaluation. It extends Swift's standard library with algorithms that work across all types conforming to Sequence and Collection protocols, enabling efficient data processing without intermediate storage.
The library specializes in combinatorial enumeration, generating all possible permutations, combinations, and product sequences from collections for testing and exploration. It also includes utilities for splitting collections into groups based on element properties or transformations, creating infinite sequences by repeating collection elements, and selecting random subsets of unique elements without replacement.
Additional capabilities include chunking collections by predicate conditions, cycling over collection elements endlessly, and performing lazy sequence operations that compute elements on demand during iteration. The library is distributed as a Swift package, with documentation and source code available through the Swift Package Manager.