swift-algorithms
swift-algorithms copied to clipboard
Commonly used sequence and collection algorithms for Swift
The libray doesn't compile under Xcode 14 and iOS 16 beta 4 **Swift Algorithms version:** `1.0.0` ### Checklist - [x ] If possible, I've reproduced the issue using the `main`...
With dictionaries, we have a [`uniquingKeysWith`](https://developer.apple.com/documentation/swift/dictionary/3127161-init) parameter. It would be helpful to have similar for [`uniqued`](https://github.com/apple/swift-algorithms/blob/main/Guides/Unique.md). This came up in a [Stack Overflow Q/A](https://stackoverflow.com/questions/72339425/how-to-filter-an-array-of-objects-with-unique-properties/72339742#72339742). The following works but relies on...
Change `endOfPrefix(while:)` and `startOfSuffix(while:)` from internal to public These two functions are generally useful so they should be public instead of internal See https://forums.swift.org/t/should-there-be-bidirectionalcollection-droplast-while/48059/14 and https://forums.swift.org/t/endofprefix-while-and-startofsuffix-while-should-be-public-instead-of-internal/56855 ### Checklist - [...
add `recursiveMap()` method. ### Checklist - [x] I've added at least one test that validates that my change is working, if appropriate - [x] I've followed the code style of...
### Description Adds a new API for detecting how two already sorted sequences overlap. It is a generalization of the `includes` function from C++. It returns a custom type instead...
### Description This is an adaptation of the `std::merge` function from the C++ language into Swift. This is the second version I've done, after [#43]. The main changes are: -...
This library adapts the C++ algorithm functions that take two sorted sequences and returns an also-sorted sequence that represents the set-difference, intersection, union, *etc.*. Instead of separate functions for each...
I noticed there’s a method for counting the unique permutations of a collection - how come there is no equivalent for combinations? For example the unique combinations of length 2...
- Changed “same” to “equal” to clarify that this is an equality (`Equatable`, `==`/`!=`) comparison, not identify comparison (`===`/`!==`). - Corrected algorithmic complexity documentation in Chunked.md - Added parameter documentation...
In c++ there has a stl function named as lower_bound which works as binary search. But in swift there has no such function. Could you please add it?