Full generation, file type cleanup

This commit is contained in:
Christoph Hagen
2024-12-25 18:06:05 +01:00
parent 41887a1401
commit 1e4682dad1
56 changed files with 1577 additions and 1103 deletions

View File

@ -27,3 +27,20 @@ extension Collection {
}
}
extension Collection where Element: Collection, Element.Element: Hashable {
func union() -> Set<Element.Element> {
reduce(into: []) { $0.formUnion($1) }
}
}
extension RangeReplaceableCollection where Element: Comparable {
mutating func insertSorted(_ element: Element) {
let index = firstIndex(where: { $0 > element }) ?? endIndex
insert(element, at: index)
}
}