Compare commits

..
3 Commits
26 changed files with 1112 additions and 268 deletions

No files matched your search

+40 -2
View File
@@ -8,7 +8,26 @@ This project follows semantic versioning.
## [Unreleased]
*No new changes.*
### Additions
- Bidirectional collections have a new `ends(with:)` method that matches
the behavior of the standard library's `starts(with:)` method. ([#224])
<!-- *No new changes.* -->
## [1.2.1] - 2025-02-10
### Changes
- The package now has a minimum Swift version of Swift 5.7. ([#240])
- Adds a project for building with Xcode. ([#246])
### Fixes
- Fix for Swift 6 language mode errors. ([#230])
- Minor improvements to documentation and performance. ([#220], [#222], [#223], [#225], [#227], [#228])
The 1.2.1 release includes contributions from [b1ackturtle], [CheATSlark], [dabrahams], [glessard], [j-f1], [marcosgriselli], [mrs1669], [natecook1000], [rex4539], and [schlagelk]. Thank you!
## [1.2.0] - 2023-11-14
@@ -338,7 +357,8 @@ This changelog's format is based on [Keep a Changelog](https://keepachangelog.co
<!-- Link references for releases -->
[Unreleased]: https://github.com/apple/swift-algorithms/compare/1.2.0...HEAD
[Unreleased]: https://github.com/apple/swift-algorithms/compare/1.2.1...HEAD
[1.2.0]: https://github.com/apple/swift-algorithms/compare/1.2.0...1.2.1
[1.2.0]: https://github.com/apple/swift-algorithms/compare/1.1.0...1.2.0
[1.1.0]: https://github.com/apple/swift-algorithms/compare/1.0.0...1.1.0
[1.0.0]: https://github.com/apple/swift-algorithms/compare/0.2.1...1.0.0
@@ -385,33 +405,50 @@ This changelog's format is based on [Keep a Changelog](https://keepachangelog.co
[#202]: https://github.com/apple/swift-algorithms/pull/202
[#210]: https://github.com/apple/swift-algorithms/pull/210
[#211]: https://github.com/apple/swift-algorithms/pull/211
[#224]: https://github.com/apple/swift-algorithms/pull/224
[#220]: https://github.com/apple/swift-algorithms/pull/220
[#222]: https://github.com/apple/swift-algorithms/pull/222
[#223]: https://github.com/apple/swift-algorithms/pull/223
[#225]: https://github.com/apple/swift-algorithms/pull/225
[#227]: https://github.com/apple/swift-algorithms/pull/227
[#228]: https://github.com/apple/swift-algorithms/pull/228
[#230]: https://github.com/apple/swift-algorithms/pull/230
[#240]: https://github.com/apple/swift-algorithms/pull/240
[#246]: https://github.com/apple/swift-algorithms/pull/246
<!-- Link references for contributors -->
[amomchilov]: https://github.com/apple/swift-algorithms/commits?author=amomchilov
[AustinConlon]: https://github.com/apple/swift-algorithms/commits?author=AustinConlon
[b1ackturtle]: https://github.com/apple/swift-algorithms/commits?author=b1ackturtle
[benrimmington]: https://github.com/apple/swift-algorithms/commits?author=benrimmington
[bjhomer]: https://github.com/apple/swift-algorithms/commits?author=bjhomer
[CheATSlark]: https://github.com/apple/swift-algorithms/commits?author=CheATSlark
[CTMacUser]: https://github.com/apple/swift-algorithms/commits?author=CTMacUser
[dabrahams]: https://github.com/apple/swift-algorithms/commits?author=dabrahams
[danielctull]: https://github.com/apple/swift-algorithms/commits?author=danielctull
[dhruvshah8]: https://github.com/apple/swift-algorithms/commits?author=dhruvshah8
[dickoff]: https://github.com/apple/swift-algorithms/commits?author=dickoff
[egorzhdan]: https://github.com/apple/swift-algorithms/commits?author=egorzhdan
[fedeci]: https://github.com/apple/swift-algorithms/commits?author=fedeci
[glessard]: https://github.com/apple/swift-algorithms/commits?author=glessard
[gwynne]: https://github.com/apple/swift-algorithms/commits?author=gwynne
[hashemi]: https://github.com/apple/swift-algorithms/commits?author=hashemi
[iainsmith]: https://github.com/apple/swift-algorithms/commits?author=iainsmith
[IanKeen]: https://github.com/apple/swift-algorithms/commits?author=IanKeen
[iSame7]: https://github.com/apple/swift-algorithms/commits?author=iSame7
[j-f1]: https://github.com/apple/swift-algorithms/commits?author=j-f1
[karwa]: https://github.com/apple/swift-algorithms/commits?author=karwa
[kylemacomber]: https://github.com/apple/swift-algorithms/commits?author=kylemacomber
[LemonSpike]: https://github.com/apple/swift-algorithms/commits?author=LemonSpike
[LucianoPAlmeida]: https://github.com/apple/swift-algorithms/commits?author=LucianoPAlmeida
[marcosgriselli]: https://github.com/apple/swift-algorithms/commits?author=marcosgriselli
[markuswntr]: https://github.com/apple/swift-algorithms/commits?author=markuswntr
[mattyoung]: https://github.com/apple/swift-algorithms/commits?author=mattyoung
[mdznr]: https://github.com/apple/swift-algorithms/commits?author=mdznr
[michiboo]: https://github.com/apple/swift-algorithms/commits?author=michiboo
[mpangburn]: https://github.com/apple/swift-algorithms/commits?author=mpangburn
[mrs1669]: https://github.com/apple/swift-algorithms/commits?author=mrs1669
[natecook1000]: https://github.com/apple/swift-algorithms/commits?author=natecook1000
[nordicio]: https://github.com/apple/swift-algorithms/commits?author=nordicio
[ole]: https://github.com/apple/swift-algorithms/commits?author=ole
@@ -419,6 +456,7 @@ This changelog's format is based on [Keep a Changelog](https://keepachangelog.co
[pmtao]: https://github.com/apple/swift-algorithms/commits?author=pmtao
[Qata]: https://github.com/apple/swift-algorithms/commits?author=Qata
[rakaramos]: https://github.com/apple/swift-algorithms/commits?author=rakaramos
[rex4539]: https://github.com/apple/swift-algorithms/commits?author=rex4539
[rockbruno]: https://github.com/apple/swift-algorithms/commits?author=rockbruno
[Roshankumar350]: https://github.com/apple/swift-algorithms/commits?author=Roshankumar350
[schlagelk]: https://github.com/apple/swift-algorithms/commits?author=schlagelk
+2 -10
View File
@@ -1,4 +1,4 @@
// swift-tools-version:6.0
// swift-tools-version:5.7
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Algorithms open source project
@@ -12,13 +12,6 @@
import PackageDescription
let availabilityDefinition = PackageDescription.SwiftSetting.unsafeFlags([
"-Xfrontend",
"-define-availability",
"-Xfrontend",
"SwiftStdlib 5.7:macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0",
])
let package = Package(
name: "swift-algorithms",
products: [
@@ -34,8 +27,7 @@ let package = Package(
name: "Algorithms",
dependencies: [
.product(name: "RealModule", package: "swift-numerics"),
],
swiftSettings: [availabilityDefinition]),
]),
.testTarget(
name: "SwiftAlgorithmsTests",
dependencies: ["Algorithms"]),
+6 -6
View File
@@ -456,9 +456,9 @@ extension Collection {
///
/// - Complexity: O(*n*), where *n* is the length of this collection.
@inlinable
public func chunked<E: Error>(
by belongInSameGroup: (Element, Element) throws(E) -> Bool
) throws(E) -> [SubSequence] {
public func chunked(
by belongInSameGroup: (Element, Element) throws -> Bool
) rethrows -> [SubSequence] {
guard !isEmpty else { return [] }
var result: [SubSequence] = []
@@ -489,9 +489,9 @@ extension Collection {
///
/// - Complexity: O(*n*), where *n* is the length of this collection.
@inlinable
public func chunked<Subject: Equatable, E: Error>(
on projection: (Element) throws(E) -> Subject
) throws(E) -> [(Subject, SubSequence)] {
public func chunked<Subject: Equatable>(
on projection: (Element) throws -> Subject
) rethrows -> [(Subject, SubSequence)] {
guard !isEmpty else { return [] }
var result: [(Subject, SubSequence)] = []
+3 -3
View File
@@ -31,9 +31,9 @@ extension Sequence {
/// - Complexity: O(*n*), where *n* is the number of elements at the start of
/// the sequence that result in `nil` when applying the transformation.
@inlinable
public func firstNonNil<Result, E: Error>(
_ transform: (Element) throws(E) -> Result?
) throws(E) -> Result? {
public func firstNonNil<Result>(
_ transform: (Element) throws -> Result?
) rethrows -> Result? {
for value in self {
if let value = try transform(value) {
return value
+2 -10
View File
@@ -19,15 +19,7 @@ extension Sequence {
/// - Returns: A dictionary containing grouped elements of self, keyed by
/// the keys derived by the `keyForValue` closure.
@inlinable
public func grouped<GroupKey, E: Error>(
by keyForValue: (Element) throws(E) -> GroupKey
) throws(E) -> [GroupKey: [Element]] {
do {
// This stdlib Dictionary initializer doesn't use typed errors,
// so we need to catch and cast any thrown error to our expected type.
return try Dictionary(grouping: self, by: keyForValue)
} catch {
throw error as! E
}
public func grouped<GroupKey>(by keyForValue: (Element) throws -> GroupKey) rethrows -> [GroupKey: [Element]] {
try Dictionary(grouping: self, by: keyForValue)
}
}
+11 -19
View File
@@ -355,9 +355,9 @@ extension Sequence where Element: Sequence {
}
@inlinable
internal func _joined<E: Error>(
by update: (inout [Element.Element], Element, Element) throws(E) -> Void
) throws(E) -> [Element.Element] {
internal func _joined(
by update: (inout [Element.Element], Element, Element) throws -> Void
) rethrows -> [Element.Element] {
var iterator = makeIterator()
guard let first = iterator.next() else { return [] }
@@ -381,14 +381,10 @@ extension Sequence where Element: Sequence {
/// }
/// // 1, 2, 6, 3, 4, 20, 5, 6
@inlinable
public func joined<E: Error>(
by separator: (Element, Element) throws(E) -> Element.Element
) throws(E) -> [Element.Element] {
// An anonymous closure is inferred as `throws(any Error)`, so we give it
// the correct type here.
let joiner: (inout [Element.Element], Element, Element) throws(E) -> Void
= { $0.append(try separator($1, $2)) }
return try _joined(by: joiner)
public func joined(
by separator: (Element, Element) throws -> Element.Element
) rethrows -> [Element.Element] {
try _joined(by: { $0.append(try separator($1, $2)) })
}
/// Returns the concatenation of the elements in this sequence of sequences,
@@ -399,16 +395,12 @@ extension Sequence where Element: Sequence {
/// }
/// // 1, 2, 200, 300, 3, 4, 400, 500, 5, 6
@inlinable
public func joined<Separator, E: Error>(
by separator: (Element, Element) throws(E) -> Separator
) throws(E) -> [Element.Element]
public func joined<Separator>(
by separator: (Element, Element) throws -> Separator
) rethrows -> [Element.Element]
where Separator: Sequence, Separator.Element == Element.Element
{
// An anonymous closure is inferred as `throws(any Error)`, so we give it
// the correct type here.
let joiner: (inout [Element.Element], Element, Element) throws(E) -> Void
= { $0.append(contentsOf: try separator($1, $2)) }
return try _joined(by: joiner)
try _joined(by: { $0.append(contentsOf: try separator($1, $2)) })
}
}
+8 -11
View File
@@ -19,13 +19,10 @@ extension Sequence {
/// - Parameters:
/// - keyForValue: A closure that returns a key for each element in `self`.
@inlinable
public func keyed<Key, E: Error>(
by keyForValue: (Element) throws(E) -> Key
) throws(E) -> [Key: Element] {
// An anonymous closure is inferred as `throws(any Error)`, so we give it
// the correct type here.
let resolve: (Key, Element, Element) throws(E) -> Element = { _, _, new in new }
return try self.keyed(by: keyForValue, resolvingConflictsWith: resolve)
public func keyed<Key>(
by keyForValue: (Element) throws -> Key
) rethrows -> [Key: Element] {
return try self.keyed(by: keyForValue, resolvingConflictsWith: { _, old, new in new })
}
/// Creates a new Dictionary from the elements of `self`, keyed by the
@@ -42,10 +39,10 @@ extension Sequence {
/// keys that are encountered. The closure returns the desired value for
/// the final dictionary.
@inlinable
public func keyed<Key, E: Error>(
by keyForValue: (Element) throws(E) -> Key,
resolvingConflictsWith resolve: (Key, Element, Element) throws(E) -> Element
) throws(E) -> [Key: Element] {
public func keyed<Key>(
by keyForValue: (Element) throws -> Key,
resolvingConflictsWith resolve: (Key, Element, Element) throws -> Element
) rethrows -> [Key: Element] {
var result = [Key: Element]()
for element in self {
+29 -57
View File
@@ -12,10 +12,10 @@
extension Sequence {
/// Implementation for min(count:areInIncreasingOrder:)
@inlinable
internal func _minImplementation<E: Error>(
internal func _minImplementation(
count: Int,
sortedBy areInIncreasingOrder: (Element, Element) throws(E) -> Bool
) throws(E) -> [Element] {
sortedBy areInIncreasingOrder: (Element, Element) throws -> Bool
) rethrows -> [Element] {
var iterator = makeIterator()
var result: [Element] = []
@@ -23,22 +23,14 @@ extension Sequence {
while result.count < count, let e = iterator.next() {
result.append(e)
}
do {
// The stdlib `sort(by:)` method doesn't use typed errors,
// so we need to catch and cast any thrown error to our expected type.
try result.sort(by: areInIncreasingOrder)
} catch {
throw error as! E
}
try result.sort(by: areInIncreasingOrder)
while let e = iterator.next() {
// To be part of `result`, `e` must be strictly less than `result.last`.
guard try areInIncreasingOrder(e, result.last!) else { continue }
result.removeLast()
// An anonymous closure is inferred as `throws(any Error)`, so we give it
// the correct type here.
let pred: (Element) throws(E) -> Bool = { try areInIncreasingOrder(e, $0) }
let insertionIndex = try result.partitioningIndex(where: pred)
let insertionIndex =
try result.partitioningIndex { try areInIncreasingOrder(e, $0) }
result.insert(e, at: insertionIndex)
}
@@ -47,10 +39,10 @@ extension Sequence {
/// Implementation for max(count:areInIncreasingOrder:)
@inlinable
internal func _maxImplementation<E: Error>(
internal func _maxImplementation(
count: Int,
sortedBy areInIncreasingOrder: (Element, Element) throws(E) -> Bool
) throws(E) -> [Element] {
sortedBy areInIncreasingOrder: (Element, Element) throws -> Bool
) rethrows -> [Element] {
var iterator = makeIterator()
var result: [Element] = []
@@ -58,21 +50,13 @@ extension Sequence {
while result.count < count, let e = iterator.next() {
result.append(e)
}
do {
// The stdlib `sort(by:)` method doesn't use typed errors,
// so we need to catch and cast any thrown error to our expected type.
try result.sort(by: areInIncreasingOrder)
} catch {
throw error as! E
}
try result.sort(by: areInIncreasingOrder)
while let e = iterator.next() {
// To be part of `result`, `e` must be greater/equal to `result.first`.
guard try !areInIncreasingOrder(e, result.first!) else { continue }
// An anonymous closure is inferred as `throws(any Error)`, so we give it
// the correct type here.
let pred: (Element) throws(E) -> Bool = { try areInIncreasingOrder(e, $0) }
let insertionIndex = try result.partitioningIndex(where: pred)
let insertionIndex =
try result.partitioningIndex { try areInIncreasingOrder(e, $0) }
assert(insertionIndex > 0)
// Inserting `e` and then removing the first element (or vice versa)
@@ -117,10 +101,10 @@ extension Sequence {
/// - Complexity: O(*k* log *k* + *nk*), where *n* is the length of the
/// sequence and *k* is `count`.
@inlinable
public func min<E: Error>(
public func min(
count: Int,
sortedBy areInIncreasingOrder: (Element, Element) throws(E) -> Bool
) throws(E) -> [Element] {
sortedBy areInIncreasingOrder: (Element, Element) throws -> Bool
) rethrows -> [Element] {
precondition(count >= 0, """
Cannot find a minimum with a negative count of elements!
"""
@@ -162,10 +146,10 @@ extension Sequence {
/// - Complexity: O(*k* log *k* + *nk*), where *n* is the length of the
/// sequence and *k* is `count`.
@inlinable
public func max<E: Error>(
public func max(
count: Int,
sortedBy areInIncreasingOrder: (Element, Element) throws(E) -> Bool
) throws(E) -> [Element] {
sortedBy areInIncreasingOrder: (Element, Element) throws -> Bool
) rethrows -> [Element] {
precondition(count >= 0, """
Cannot find a maximum with a negative count of elements!
"""
@@ -263,10 +247,10 @@ extension Collection {
/// - Complexity: O(*k* log *k* + *nk*), where *n* is the length of the
/// collection and *k* is `count`.
@inlinable
public func min<E: Error>(
public func min(
count: Int,
sortedBy areInIncreasingOrder: (Element, Element) throws(E) -> Bool
) throws(E) -> [Element] {
sortedBy areInIncreasingOrder: (Element, Element) throws -> Bool
) rethrows -> [Element] {
precondition(count >= 0, """
Cannot find a minimum with a negative count of elements!
"""
@@ -283,13 +267,7 @@ extension Collection {
// If we're attempting to prefix more than 10% of the collection, it's
// faster to sort everything.
guard prefixCount < (self.count / 10) else {
do {
// The stdlib `sorted(by:)` method doesn't use typed errors,
// so we need to catch and cast any thrown error to our expected type.
return Array(try sorted(by: areInIncreasingOrder).prefix(prefixCount))
} catch {
throw error as! E
}
return Array(try sorted(by: areInIncreasingOrder).prefix(prefixCount))
}
return try _minImplementation(count: count, sortedBy: areInIncreasingOrder)
@@ -323,10 +301,10 @@ extension Collection {
/// - Complexity: O(*k* log *k* + *nk*), where *n* is the length of the
/// collection and *k* is `count`.
@inlinable
public func max<E: Error>(
public func max(
count: Int,
sortedBy areInIncreasingOrder: (Element, Element) throws(E) -> Bool
) throws(E) -> [Element] {
sortedBy areInIncreasingOrder: (Element, Element) throws -> Bool
) rethrows -> [Element] {
precondition(count >= 0, """
Cannot find a maximum with a negative count of elements!
"""
@@ -343,13 +321,7 @@ extension Collection {
// If we're attempting to prefix more than 10% of the collection, it's
// faster to sort everything.
guard suffixCount < (self.count / 10) else {
do {
// The stdlib `sorted(by:)` method doesn't use typed errors,
// so we need to catch and cast any thrown error to our expected type.
return Array(try sorted(by: areInIncreasingOrder).suffix(suffixCount))
} catch {
throw error as! E
}
return Array(try sorted(by: areInIncreasingOrder).suffix(suffixCount))
}
return try _maxImplementation(count: count, sortedBy: areInIncreasingOrder)
@@ -455,9 +427,9 @@ extension Sequence {
///
/// - Complexity: O(*n*), where *n* is the length of the sequence.
@inlinable
public func minAndMax<E: Error>(
by areInIncreasingOrder: (Element, Element) throws(E) -> Bool
) throws(E) -> (min: Element, max: Element)? {
public func minAndMax(
by areInIncreasingOrder: (Element, Element) throws -> Bool
) rethrows -> (min: Element, max: Element)? {
// Check short sequences.
var iterator = makeIterator()
guard var lowest = iterator.next() else { return nil }
+58 -73
View File
@@ -22,11 +22,11 @@ extension MutableCollection {
/// - Precondition:
/// `n == distance(from: range.lowerBound, to: range.upperBound)`
@inlinable
internal mutating func stablePartition<E: Error>(
internal mutating func stablePartition(
count n: Int,
subrange: Range<Index>,
by belongsInSecondPartition: (Element) throws(E) -> Bool
) throws(E) -> Index {
by belongsInSecondPartition: (Element) throws -> Bool
) rethrows -> Index {
if n == 0 { return subrange.lowerBound }
if n == 1 {
return try belongsInSecondPartition(self[subrange.lowerBound])
@@ -58,10 +58,10 @@ extension MutableCollection {
///
/// - Complexity: O(*n* log *n*), where *n* is the length of this collection.
@inlinable
public mutating func stablePartition<E: Error>(
public mutating func stablePartition(
subrange: Range<Index>,
by belongsInSecondPartition: (Element) throws(E) -> Bool
) throws(E) -> Index {
by belongsInSecondPartition: (Element) throws-> Bool
) rethrows -> Index {
try stablePartition(
count: distance(from: subrange.lowerBound, to: subrange.upperBound),
subrange: subrange,
@@ -78,9 +78,9 @@ extension MutableCollection {
///
/// - Complexity: O(*n* log *n*), where *n* is the length of this collection.
@inlinable
public mutating func stablePartition<E: Error>(
by belongsInSecondPartition: (Element) throws(E) -> Bool
) throws(E) -> Index {
public mutating func stablePartition(
by belongsInSecondPartition: (Element) throws-> Bool
) rethrows -> Index {
try stablePartition(
subrange: startIndex..<endIndex,
by: belongsInSecondPartition)
@@ -97,22 +97,14 @@ extension MutableCollection {
///
/// - Complexity: O(*n*) where n is the length of the collection.
@inlinable
public mutating func partition<E: Error>(
public mutating func partition(
subrange: Range<Index>,
by belongsInSecondPartition: (Element) throws(E) -> Bool
) throws(E) -> Index {
by belongsInSecondPartition: (Element) throws -> Bool
) rethrows -> Index {
// This version of `partition(subrange:)` is half stable; the elements in
// the first partition retain their original relative order.
var i: Index
do {
// The stdlib `firstIndex(where:)` method doesn't use typed errors,
// so we need to catch and cast any thrown error to our expected type.
guard let firstI = try self[subrange].firstIndex(where: belongsInSecondPartition)
else { return subrange.upperBound }
i = firstI
} catch {
throw error as! E
}
guard var i = try self[subrange].firstIndex(where: belongsInSecondPartition)
else { return subrange.upperBound }
var j = index(after: i)
while j != subrange.upperBound {
@@ -133,10 +125,10 @@ extension MutableCollection where Self: BidirectionalCollection {
///
/// - Complexity: O(*n*) where n is the length of the collection.
@inlinable
public mutating func partition<E: Error>(
public mutating func partition(
subrange: Range<Index>,
by belongsInSecondPartition: (Element) throws(E) -> Bool
) throws(E) -> Index {
by belongsInSecondPartition: (Element) throws -> Bool
) rethrows -> Index {
var lo = subrange.lowerBound
var hi = subrange.upperBound
@@ -193,9 +185,9 @@ extension Collection {
/// - Complexity: O(log *n*), where *n* is the length of this collection if
/// the collection conforms to `RandomAccessCollection`, otherwise O(*n*).
@inlinable
public func partitioningIndex<E: Error>(
where belongsInSecondPartition: (Element) throws(E) -> Bool
) throws(E) -> Index {
public func partitioningIndex(
where belongsInSecondPartition: (Element) throws -> Bool
) rethrows -> Index {
var n = count
var l = startIndex
@@ -244,9 +236,9 @@ extension Sequence {
///
/// - Complexity: O(*n*), where *n* is the length of the sequence.
@inlinable
public func partitioned<E: Error>(
by predicate: (Element) throws(E) -> Bool
) throws(E) -> (falseElements: [Element], trueElements: [Element]) {
public func partitioned(
by predicate: (Element) throws -> Bool
) rethrows -> (falseElements: [Element], trueElements: [Element]) {
var lhs = [Element]()
var rhs = [Element]()
@@ -289,9 +281,9 @@ extension Collection {
///
/// - Complexity: O(*n*), where *n* is the length of the collection.
@inlinable
public func partitioned<E: Error>(
by predicate: (Element) throws(E) -> Bool
) throws(E) -> (falseElements: [Element], trueElements: [Element]) {
public func partitioned(
by predicate: (Element) throws -> Bool
) rethrows -> (falseElements: [Element], trueElements: [Element]) {
guard !self.isEmpty else {
return ([], [])
}
@@ -308,47 +300,40 @@ extension Collection {
// We will use this to partition the single array into two.
var midPoint: Int = 0
let elements: [Element]
do {
// This stdlib `Array` initializer doesn't use typed errors,
// so we need to catch and cast any thrown error to our expected type.
elements = try Array(
unsafeUninitializedCapacity: count,
initializingWith: { buffer, initializedCount in
var lhs = buffer.baseAddress!
var rhs = lhs + buffer.count
do {
for element in self {
if try predicate(element) {
rhs -= 1
rhs.initialize(to: element)
} else {
lhs.initialize(to: element)
lhs += 1
}
let elements = try [Element](
unsafeUninitializedCapacity: count,
initializingWith: { buffer, initializedCount in
var lhs = buffer.baseAddress!
var rhs = lhs + buffer.count
do {
for element in self {
if try predicate(element) {
rhs -= 1
rhs.initialize(to: element)
} else {
lhs.initialize(to: element)
lhs += 1
}
precondition(lhs == rhs, """
Collection's `count` differed from the number of elements iterated.
"""
)
let rhsIndex = rhs - buffer.baseAddress!
buffer[rhsIndex...].reverse()
initializedCount = buffer.count
midPoint = rhsIndex
} catch {
let lhsCount = lhs - buffer.baseAddress!
let rhsCount = (buffer.baseAddress! + buffer.count) - rhs
buffer.baseAddress!.deinitialize(count: lhsCount)
rhs.deinitialize(count: rhsCount)
throw error
}
})
} catch {
throw error as! E
}
precondition(lhs == rhs, """
Collection's `count` differed from the number of elements iterated.
"""
)
let rhsIndex = rhs - buffer.baseAddress!
buffer[rhsIndex...].reverse()
initializedCount = buffer.count
midPoint = rhsIndex
} catch {
let lhsCount = lhs - buffer.baseAddress!
let rhsCount = (buffer.baseAddress! + buffer.count) - rhs
buffer.baseAddress!.deinitialize(count: lhsCount)
rhs.deinitialize(count: rhsCount)
throw error
}
})
let lhs = elements[..<midPoint]
let rhs = elements[midPoint...]
+22 -1
View File
@@ -10,7 +10,28 @@
//===----------------------------------------------------------------------===//
// For log(_:) and root(_:_:)
#if swift(>=5.11)
#if ALGORITHMS_DARWIN_ONLY
internal import Darwin
extension Double {
@_transparent
internal static func root(_ x: Double, _ n: Int) -> Double {
guard x >= 0 || n % 2 != 0 else { return .nan }
if n == 3 { return cbrt(x) }
return Double(signOf: x, magnitudeOf: pow(x.magnitude, 1/Double(n)))
}
@_transparent
internal static func log(_ x: Double) -> Double {
Darwin.log(x)
}
@_transparent
internal static func log(onePlus x: Double) -> Double {
Darwin.log1p(x)
}
}
#elseif swift(>=5.11)
internal import RealModule
#elseif swift(>=5.10)
import RealModule
+20 -22
View File
@@ -112,16 +112,13 @@ extension Sequence {
///
/// - Complexity: O(_n_), where _n_ is the length of the sequence.
@inlinable
public func reductions<Result, E: Error>(
public func reductions<Result>(
_ initial: Result,
_ transform: (Result, Element) throws(E) -> Result
) throws(E) -> [Result] {
// An anonymous closure is inferred as `throws(any Error)`, so we give it
// the correct type here.
let reducer: (inout Result, Element) throws(E) -> Void = { result, element in
_ transform: (Result, Element) throws -> Result
) rethrows -> [Result] {
try reductions(into: initial) { result, element in
result = try transform(result, element)
}
return try reductions(into: initial, reducer)
}
/// Returns an array containing the accumulated results of combining the
@@ -159,10 +156,11 @@ extension Sequence {
///
/// - Complexity: O(_n_), where _n_ is the length of the sequence.
@inlinable
public func reductions<Result, E: Error>(
public func reductions<Result>(
into initial: Result,
_ transform: (inout Result, Element) throws(E) -> Void
) throws(E) -> [Result] {
_ transform: (inout Result, Element) throws -> Void
) rethrows -> [Result] {
var output = [Result]()
output.reserveCapacity(underestimatedCount + 1)
output.append(initial)
@@ -417,9 +415,9 @@ extension Sequence {
///
/// - Complexity: O(_n_), where _n_ is the length of the sequence.
@inlinable
public func reductions<E: Error>(
_ transform: (Element, Element) throws(E) -> Element
) throws(E) -> [Element] {
public func reductions(
_ transform: (Element, Element) throws -> Element
) rethrows -> [Element] {
var iterator = makeIterator()
guard let initial = iterator.next() else { return [] }
return try IteratorSequence(iterator).reductions(initial, transform)
@@ -584,19 +582,19 @@ extension LazySequenceProtocol {
extension Sequence {
@available(*, deprecated, message: "Use reductions(_:_:) instead.")
@inlinable
public func scan<Result, E: Error>(
public func scan<Result>(
_ initial: Result,
_ transform: (Result, Element) throws(E) -> Result
) throws(E) -> [Result] {
_ transform: (Result, Element) throws -> Result
) rethrows -> [Result] {
try reductions(initial, transform)
}
@available(*, deprecated, message: "Use reductions(into:_:) instead.")
@inlinable
public func scan<Result, E: Error>(
public func scan<Result>(
into initial: Result,
_ transform: (inout Result, Element) throws(E) -> Void
) throws(E) -> [Result] {
_ transform: (inout Result, Element) throws -> Void
) rethrows -> [Result] {
try reductions(into: initial, transform)
}
}
@@ -614,9 +612,9 @@ extension LazySequenceProtocol {
extension Sequence {
@available(*, deprecated, message: "Use reductions(_:) instead.")
@inlinable
public func scan<E: Error>(
_ transform: (Element, Element) throws(E) -> Element
) throws(E) -> [Element] {
public func scan(
_ transform: (Element, Element) throws -> Element
) rethrows -> [Element] {
try reductions(transform)
}
}
+10 -10
View File
@@ -24,9 +24,9 @@ extension BidirectionalCollection {
///
/// - Complexity: O(*n*), where *n* is the length of the collection.
@inlinable
public func suffix<E: Error>(
while predicate: (Element) throws(E) -> Bool
) throws(E) -> SubSequence {
public func suffix(
while predicate: (Element) throws -> Bool
) rethrows -> SubSequence {
try self[startOfSuffix(while: predicate)...]
}
}
@@ -46,11 +46,11 @@ extension Collection {
///
/// - Complexity: O(*n*), where *n* is the length of the collection.
@inlinable
public func endOfPrefix<E: Error>(
while predicate: (Element) throws(E) -> Bool
) throws(E) -> Index {
public func endOfPrefix(
while predicate: (Element) throws -> Bool
) rethrows -> Index {
var index = startIndex
while index != endIndex, try predicate(self[index]) {
while try index != endIndex && predicate(self[index]) {
formIndex(after: &index)
}
return index
@@ -72,9 +72,9 @@ extension BidirectionalCollection {
///
/// - Complexity: O(*n*), where *n* is the length of the collection.
@inlinable
public func startOfSuffix<E: Error>(
while predicate: (Element) throws(E) -> Bool
) throws(E) -> Index {
public func startOfSuffix(
while predicate: (Element) throws -> Bool
) rethrows -> Index {
var index = endIndex
while index != startIndex {
let after = index
+39 -33
View File
@@ -26,10 +26,11 @@ extension Collection {
/// omitted from the resulting slice.
///
/// - Complexity: O(*n*), where *n* is the length of this collection.
///
@inlinable
public func trimmingPrefix<E: Error>(
while predicate: (Element) throws(E) -> Bool
) throws(E) -> SubSequence {
public func trimmingPrefix(
while predicate: (Element) throws -> Bool
) rethrows -> SubSequence {
let start = try endOfPrefix(while: predicate)
return self[start..<endIndex]
}
@@ -54,11 +55,12 @@ extension Collection where Self: RangeReplaceableCollection {
/// removed from the string.
///
/// - Complexity: O(*n*), where *n* is the length of this collection.
///
@inlinable
@_disfavoredOverload
public mutating func trimPrefix<E: Error>(
while predicate: (Element) throws(E) -> Bool
) throws(E) {
public mutating func trimPrefix(
while predicate: (Element) throws -> Bool
) rethrows {
let startOfResult = try endOfPrefix(while: predicate)
removeSubrange(startIndex..<startOfResult)
}
@@ -79,12 +81,12 @@ extension Collection where Self == Self.SubSequence {
/// be removed from the string.
///
/// - Complexity: O(*n*), where *n* is the length of this collection.
///
@inlinable
public mutating func trimPrefix<E: Error>(
while predicate: (Element) throws(E) -> Bool
) throws(E) {
let start = try endOfPrefix(while: predicate)
self = self[start..<endIndex]
public mutating func trimPrefix(
while predicate: (Element) throws -> Bool
) rethrows {
self = try trimmingPrefix(while: predicate)
}
}
@@ -106,12 +108,12 @@ extension BidirectionalCollection {
/// omitted from the resulting slice.
///
/// - Complexity: O(*n*), where *n* is the length of this collection.
///
@inlinable
public func trimming<E: Error>(
while predicate: (Element) throws(E) -> Bool
) throws(E) -> SubSequence {
let start = try endOfPrefix(while: predicate)
return try self[start..<endIndex].trimmingSuffix(while: predicate)
public func trimming(
while predicate: (Element) throws -> Bool
) rethrows -> SubSequence {
try trimmingPrefix(while: predicate).trimmingSuffix(while: predicate)
}
/// Returns a `SubSequence` formed by discarding all elements at the end of
@@ -127,10 +129,11 @@ extension BidirectionalCollection {
/// omitted from the resulting slice.
///
/// - Complexity: O(*n*), where *n* is the length of this collection.
///
@inlinable
public func trimmingSuffix<E: Error>(
while predicate: (Element) throws(E) -> Bool
) throws(E) -> SubSequence {
public func trimmingSuffix(
while predicate: (Element) throws -> Bool
) rethrows -> SubSequence {
let end = try startOfSuffix(while: predicate)
return self[startIndex..<end]
}
@@ -155,14 +158,14 @@ extension BidirectionalCollection where Self: RangeReplaceableCollection {
/// removed from the string.
///
/// - Complexity: O(*n*), where *n* is the length of this collection.
///
@inlinable
@_disfavoredOverload
public mutating func trim<E: Error>(
while predicate: (Element) throws(E) -> Bool
) throws(E) {
let start = try endOfPrefix(while: predicate)
self.removeSubrange(startIndex..<start)
public mutating func trim(
while predicate: (Element) throws -> Bool
) rethrows {
try trimSuffix(while: predicate)
try trimPrefix(while: predicate)
}
/// Mutates a `BidirectionalCollection` by discarding all elements at the end
@@ -179,11 +182,12 @@ extension BidirectionalCollection where Self: RangeReplaceableCollection {
/// removed from the string.
///
/// - Complexity: O(*n*), where *n* is the length of this collection.
///
@inlinable
@_disfavoredOverload
public mutating func trimSuffix<E: Error>(
while predicate: (Element) throws(E) -> Bool
) throws(E) {
public mutating func trimSuffix(
while predicate: (Element) throws -> Bool
) rethrows {
let endOfResult = try startOfSuffix(while: predicate)
removeSubrange(endOfResult..<endIndex)
}
@@ -204,10 +208,11 @@ extension BidirectionalCollection where Self == Self.SubSequence {
/// removed from the string.
///
/// - Complexity: O(*n*), where *n* is the length of this collection.
///
@inlinable
public mutating func trim<E: Error>(
while predicate: (Element) throws(E) -> Bool
) throws(E) {
public mutating func trim(
while predicate: (Element) throws -> Bool
) rethrows {
self = try trimming(while: predicate)
}
@@ -225,10 +230,11 @@ extension BidirectionalCollection where Self == Self.SubSequence {
/// removed from the string.
///
/// - Complexity: O(*n*), where *n* is the length of this collection.
///
@inlinable
public mutating func trimSuffix<E: Error>(
while predicate: (Element) throws(E) -> Bool
) throws(E) {
public mutating func trimSuffix(
while predicate: (Element) throws -> Bool
) rethrows {
self = try trimmingSuffix(while: predicate)
}
}
+3 -3
View File
@@ -112,9 +112,9 @@ extension Sequence {
///
/// - Complexity: O(*n*), where *n* is the length of the sequence.
@inlinable
public func uniqued<Subject: Hashable, E: Error>(
on projection: (Element) throws(E) -> Subject
) throws(E) -> [Element] {
public func uniqued<Subject: Hashable>(
on projection: (Element) throws -> Subject
) rethrows -> [Element] {
var seen: Set<Subject> = []
var result: [Element] = []
for element in self {
@@ -16,7 +16,7 @@ func validateRandomSamples<S: Sequence>(
_ samples: [Int: Int],
elements: S,
expectedValue: Int,
file: StaticString = #file, line: UInt = #line
file: StaticString = (#file), line: UInt = #line
) where S.Element == Int {
let expectedRange = ((expectedValue / 3) * 2) ... ((expectedValue / 3) * 4)
XCTAssertEqualSequences(samples.keys.sorted(), elements,
@@ -78,7 +78,7 @@ func XCTAssertEqualSequences<S1: Sequence, S2: Sequence>(
_ expression1: @autoclosure () throws -> S1,
_ expression2: @autoclosure () throws -> S2,
_ message: @autoclosure () -> String = "",
file: StaticString = #file, line: UInt = #line
file: StaticString = (#file), line: UInt = #line
) rethrows where S1.Element: Equatable, S1.Element == S2.Element {
try XCTAssertEqualSequences(expression1(), expression2(), by: ==,
message(), file: file, line: line)
@@ -88,7 +88,7 @@ func XCTAssertEqualSequences<S1: Sequence, S2: Sequence>(
func XCTAssertUnorderedEqualSequences<S1: Sequence, S2: Sequence>(
_ expression1: @autoclosure () throws -> S1,
_ expression2: @autoclosure () throws -> S2,
file: StaticString = #file, line: UInt = #line
file: StaticString = (#file), line: UInt = #line
) rethrows where S1.Element: Equatable, S1.Element == S2.Element {
var s1 = Array(try expression1())
var missing: [S1.Element] = []
@@ -116,7 +116,7 @@ func XCTAssertEqualSequences<S1: Sequence, S2: Sequence>(
_ expression2: @autoclosure () throws -> S2,
by areEquivalent: (S1.Element, S1.Element) -> Bool,
_ message: @autoclosure () -> String = "",
file: StaticString = #file, line: UInt = #line
file: StaticString = (#file), line: UInt = #line
) rethrows where S1.Element == S2.Element {
func fail(_ reason: String) {
@@ -153,7 +153,7 @@ func XCTAssertEqualCollections<C1: Collection, C2: Collection>(
_ expression1: @autoclosure () throws -> C1,
_ expression2: @autoclosure () throws -> C2,
_ message: @autoclosure () -> String = "",
file: StaticString = #file, line: UInt = #line
file: StaticString = (#file), line: UInt = #line
) rethrows where C1.Element: Equatable, C1.Element == C2.Element {
let c1 = try expression1()
let c2 = try expression2()
+2 -3
View File
@@ -75,10 +75,9 @@ final class TrimTests: XCTestCase {
}
// Self == Self.Subsequence
func testTrimPrefixNoAmbiguity() throws {
func testTrimPrefixNoAmbiguity() {
var values = [2, 10, 12, 15, 20, 100] as ArraySlice
// FIXME: `trimPrefix` in the _StringProcessing module always `throws`
try values.trimPrefix { $0.isMultiple(of: 2) }
values.trimPrefix { $0.isMultiple(of: 2) }
XCTAssertEqual(values, [15, 20, 100])
}
+39
View File
@@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Algorithms open source project
//
// Copyright (c) 2023 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
//
//===----------------------------------------------------------------------===//
PRODUCT_NAME = Algorithms
PRODUCT_BUNDLE_IDENTIFIER = org.swift.Algorithms
SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator watchos watchsimulator appletvos appletvsimulator
ARCHS = $(ARCHS_STANDARD)
MACOSX_DEPLOYMENT_TARGET = 12.0
IPHONEOS_DEPLOYMENT_TARGET = 15.0
WATCHOS_DEPLOYMENT_TARGET = 8.0
TVOS_DEPLOYMENT_TARGET = 15.0
MARKETING_VERSION = 1.2
CURRENT_PROJECT_VERSION = 1
VERSIONING_SYSTEM = apple-generic
VERSION_INFO_PREFIX =
DYLIB_COMPATIBILITY_VERSION = $(CURRENT_PROJECT_VERSION)
DYLIB_CURRENT_VERSION = $(CURRENT_PROJECT_VERSION)
INSTALL_PATH = $(LOCAL_LIBRARY_DIR)/Frameworks
SKIP_INSTALL = YES
DYLIB_INSTALL_NAME_BASE = @rpath
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/../Frameworks @loader_path/Frameworks
ENABLE_TESTABILITY = NO
ENABLE_TESTABILITY[config=Debug] = YES
GENERATE_INFOPLIST_FILE = YES
+566
View File
@@ -0,0 +1,566 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 60;
objects = {
/* Begin PBXBuildFile section */
4347CECC2CE1D54900CD2979 /* Suffix.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CEA52CE1D54900CD2979 /* Suffix.swift */; };
4347CECD2CE1D54900CD2979 /* Chunked.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CE8F2CE1D54900CD2979 /* Chunked.swift */; };
4347CECE2CE1D54900CD2979 /* Keyed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CE9B2CE1D54900CD2979 /* Keyed.swift */; };
4347CECF2CE1D54900CD2979 /* Stride.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CEA42CE1D54900CD2979 /* Stride.swift */; };
4347CED02CE1D54900CD2979 /* Windows.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CEA82CE1D54900CD2979 /* Windows.swift */; };
4347CED32CE1D54900CD2979 /* Partition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CE9D2CE1D54900CD2979 /* Partition.swift */; };
4347CED52CE1D54900CD2979 /* FirstNonNil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CE952CE1D54900CD2979 /* FirstNonNil.swift */; };
4347CED62CE1D54900CD2979 /* Rotate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CEA22CE1D54900CD2979 /* Rotate.swift */; };
4347CEDF2CE1D54900CD2979 /* Split.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CEA32CE1D54900CD2979 /* Split.swift */; };
4347CEE02CE1D54900CD2979 /* Chain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CE8E2CE1D54900CD2979 /* Chain.swift */; };
4347CEE12CE1D54900CD2979 /* Trim.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CEA62CE1D54900CD2979 /* Trim.swift */; };
4347CEE22CE1D54900CD2979 /* Product.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CE9F2CE1D54900CD2979 /* Product.swift */; };
4347CEE42CE1D54900CD2979 /* Indexed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CE982CE1D54900CD2979 /* Indexed.swift */; };
4347CEE52CE1D54900CD2979 /* Documentation.docc in Sources */ = {isa = PBXBuildFile; fileRef = 4347CE932CE1D54900CD2979 /* Documentation.docc */; };
4347CEE82CE1D54900CD2979 /* Combinations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CE902CE1D54900CD2979 /* Combinations.swift */; };
4347CEE92CE1D54900CD2979 /* MinMax.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CE9C2CE1D54900CD2979 /* MinMax.swift */; };
4347CEEA2CE1D54900CD2979 /* Joined.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CE9A2CE1D54900CD2979 /* Joined.swift */; };
4347CEEB2CE1D54900CD2979 /* Grouped.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CE972CE1D54900CD2979 /* Grouped.swift */; };
4347CEED2CE1D54900CD2979 /* AdjacentPairs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CE8D2CE1D54900CD2979 /* AdjacentPairs.swift */; };
4347CEEE2CE1D54900CD2979 /* Permutations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CE9E2CE1D54900CD2979 /* Permutations.swift */; };
4347CEF02CE1D54900CD2979 /* FlattenCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CE962CE1D54900CD2979 /* FlattenCollection.swift */; };
4347CEF32CE1D54900CD2979 /* Reductions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CEA12CE1D54900CD2979 /* Reductions.swift */; };
4347CEF42CE1D54900CD2979 /* Intersperse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CE992CE1D54900CD2979 /* Intersperse.swift */; };
4347CEF52CE1D54900CD2979 /* RandomSample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CEA02CE1D54900CD2979 /* RandomSample.swift */; };
4347CEFB2CE1D54900CD2979 /* Unique.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CEA72CE1D54900CD2979 /* Unique.swift */; };
4347CEFD2CE1D54900CD2979 /* EitherSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CE942CE1D54900CD2979 /* EitherSequence.swift */; };
4347CEFE2CE1D54900CD2979 /* Cycle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CE922CE1D54900CD2979 /* Cycle.swift */; };
4347CEFF2CE1D54900CD2979 /* Compacted.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CE912CE1D54900CD2979 /* Compacted.swift */; };
4347CF262CE1D56C00CD2979 /* IndexedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF112CE1D56C00CD2979 /* IndexedTests.swift */; };
4347CF272CE1D56C00CD2979 /* RotateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF1B2CE1D56C00CD2979 /* RotateTests.swift */; };
4347CF282CE1D56C00CD2979 /* RandomSampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF192CE1D56C00CD2979 /* RandomSampleTests.swift */; };
4347CF292CE1D56C00CD2979 /* StrideTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF1D2CE1D56C00CD2979 /* StrideTests.swift */; };
4347CF2A2CE1D56C00CD2979 /* IntersperseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF122CE1D56C00CD2979 /* IntersperseTests.swift */; };
4347CF2B2CE1D56C00CD2979 /* CombinationsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF0C2CE1D56C00CD2979 /* CombinationsTests.swift */; };
4347CF2C2CE1D56C00CD2979 /* SplitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF1C2CE1D56C00CD2979 /* SplitTests.swift */; };
4347CF2D2CE1D56C00CD2979 /* ReductionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF1A2CE1D56C00CD2979 /* ReductionsTests.swift */; };
4347CF2E2CE1D56C00CD2979 /* TrimTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF202CE1D56C00CD2979 /* TrimTests.swift */; };
4347CF2F2CE1D56C00CD2979 /* FirstNonNilTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF0F2CE1D56C00CD2979 /* FirstNonNilTests.swift */; };
4347CF302CE1D56C00CD2979 /* SuffixTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF1E2CE1D56C00CD2979 /* SuffixTests.swift */; };
4347CF312CE1D56C00CD2979 /* KeyedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF142CE1D56C00CD2979 /* KeyedTests.swift */; };
4347CF322CE1D56C00CD2979 /* UniqueTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF222CE1D56C00CD2979 /* UniqueTests.swift */; };
4347CF332CE1D56C00CD2979 /* PermutationsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF172CE1D56C00CD2979 /* PermutationsTests.swift */; };
4347CF342CE1D56C00CD2979 /* CompactedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF0D2CE1D56C00CD2979 /* CompactedTests.swift */; };
4347CF352CE1D56C00CD2979 /* UniquePermutationsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF212CE1D56C00CD2979 /* UniquePermutationsTests.swift */; };
4347CF362CE1D56C00CD2979 /* GroupedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF102CE1D56C00CD2979 /* GroupedTests.swift */; };
4347CF372CE1D56C00CD2979 /* MinMaxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF152CE1D56C00CD2979 /* MinMaxTests.swift */; };
4347CF382CE1D56C00CD2979 /* ProductTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF182CE1D56C00CD2979 /* ProductTests.swift */; };
4347CF392CE1D56C00CD2979 /* ChainTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF0A2CE1D56C00CD2979 /* ChainTests.swift */; };
4347CF3A2CE1D56C00CD2979 /* ChunkedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF0B2CE1D56C00CD2979 /* ChunkedTests.swift */; };
4347CF3B2CE1D56C00CD2979 /* PartitionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF162CE1D56C00CD2979 /* PartitionTests.swift */; };
4347CF3C2CE1D56C00CD2979 /* CycleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF0E2CE1D56C00CD2979 /* CycleTests.swift */; };
4347CF3D2CE1D56C00CD2979 /* AdjacentPairsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF092CE1D56C00CD2979 /* AdjacentPairsTests.swift */; };
4347CF3E2CE1D56C00CD2979 /* TestUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF1F2CE1D56C00CD2979 /* TestUtilities.swift */; };
4347CF3F2CE1D56C00CD2979 /* WindowsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF232CE1D56C00CD2979 /* WindowsTests.swift */; };
4347CF402CE1D56C00CD2979 /* JoinedTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4347CF132CE1D56C00CD2979 /* JoinedTests.swift */; };
7D489E4829CE969D00499B21 /* Algorithms.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D489E3F29CE969D00499B21 /* Algorithms.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
7D489E4929CE969D00499B21 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 7D489E3629CE969D00499B21 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 7D489E3E29CE969D00499B21;
remoteInfo = Algorithms;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
4347CE862CE1D54900CD2979 /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = CHANGELOG.md; path = ../CHANGELOG.md; sourceTree = SOURCE_ROOT; };
4347CE872CE1D54900CD2979 /* CODE_OF_CONDUCT.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = CODE_OF_CONDUCT.md; path = ../CODE_OF_CONDUCT.md; sourceTree = SOURCE_ROOT; };
4347CE882CE1D54900CD2979 /* CONTRIBUTING.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = CONTRIBUTING.md; path = ../CONTRIBUTING.md; sourceTree = SOURCE_ROOT; };
4347CE892CE1D54900CD2979 /* LICENSE.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = LICENSE.txt; path = ../LICENSE.txt; sourceTree = SOURCE_ROOT; };
4347CE8A2CE1D54900CD2979 /* Package.resolved */ = {isa = PBXFileReference; lastKnownFileType = text; name = Package.resolved; path = ../Package.resolved; sourceTree = SOURCE_ROOT; };
4347CE8B2CE1D54900CD2979 /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Package.swift; path = ../Package.swift; sourceTree = SOURCE_ROOT; };
4347CE8C2CE1D54900CD2979 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = SOURCE_ROOT; };
4347CE8D2CE1D54900CD2979 /* AdjacentPairs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdjacentPairs.swift; sourceTree = "<group>"; };
4347CE8E2CE1D54900CD2979 /* Chain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Chain.swift; sourceTree = "<group>"; };
4347CE8F2CE1D54900CD2979 /* Chunked.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Chunked.swift; sourceTree = "<group>"; };
4347CE902CE1D54900CD2979 /* Combinations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Combinations.swift; sourceTree = "<group>"; };
4347CE912CE1D54900CD2979 /* Compacted.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Compacted.swift; sourceTree = "<group>"; };
4347CE922CE1D54900CD2979 /* Cycle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Cycle.swift; sourceTree = "<group>"; };
4347CE932CE1D54900CD2979 /* Documentation.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = Documentation.docc; sourceTree = "<group>"; };
4347CE942CE1D54900CD2979 /* EitherSequence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EitherSequence.swift; sourceTree = "<group>"; };
4347CE952CE1D54900CD2979 /* FirstNonNil.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstNonNil.swift; sourceTree = "<group>"; };
4347CE962CE1D54900CD2979 /* FlattenCollection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlattenCollection.swift; sourceTree = "<group>"; };
4347CE972CE1D54900CD2979 /* Grouped.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Grouped.swift; sourceTree = "<group>"; };
4347CE982CE1D54900CD2979 /* Indexed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Indexed.swift; sourceTree = "<group>"; };
4347CE992CE1D54900CD2979 /* Intersperse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Intersperse.swift; sourceTree = "<group>"; };
4347CE9A2CE1D54900CD2979 /* Joined.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Joined.swift; sourceTree = "<group>"; };
4347CE9B2CE1D54900CD2979 /* Keyed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Keyed.swift; sourceTree = "<group>"; };
4347CE9C2CE1D54900CD2979 /* MinMax.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MinMax.swift; sourceTree = "<group>"; };
4347CE9D2CE1D54900CD2979 /* Partition.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Partition.swift; sourceTree = "<group>"; };
4347CE9E2CE1D54900CD2979 /* Permutations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Permutations.swift; sourceTree = "<group>"; };
4347CE9F2CE1D54900CD2979 /* Product.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Product.swift; sourceTree = "<group>"; };
4347CEA02CE1D54900CD2979 /* RandomSample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RandomSample.swift; sourceTree = "<group>"; };
4347CEA12CE1D54900CD2979 /* Reductions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Reductions.swift; sourceTree = "<group>"; };
4347CEA22CE1D54900CD2979 /* Rotate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Rotate.swift; sourceTree = "<group>"; };
4347CEA32CE1D54900CD2979 /* Split.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Split.swift; sourceTree = "<group>"; };
4347CEA42CE1D54900CD2979 /* Stride.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Stride.swift; sourceTree = "<group>"; };
4347CEA52CE1D54900CD2979 /* Suffix.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Suffix.swift; sourceTree = "<group>"; };
4347CEA62CE1D54900CD2979 /* Trim.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Trim.swift; sourceTree = "<group>"; };
4347CEA72CE1D54900CD2979 /* Unique.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Unique.swift; sourceTree = "<group>"; };
4347CEA82CE1D54900CD2979 /* Windows.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Windows.swift; sourceTree = "<group>"; };
4347CEC82CE1D54900CD2979 /* swift-algorithms.xcworkspace */ = {isa = PBXFileReference; lastKnownFileType = wrapper.workspace; path = "swift-algorithms.xcworkspace"; sourceTree = "<group>"; };
4347CF092CE1D56C00CD2979 /* AdjacentPairsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdjacentPairsTests.swift; sourceTree = "<group>"; };
4347CF0A2CE1D56C00CD2979 /* ChainTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChainTests.swift; sourceTree = "<group>"; };
4347CF0B2CE1D56C00CD2979 /* ChunkedTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChunkedTests.swift; sourceTree = "<group>"; };
4347CF0C2CE1D56C00CD2979 /* CombinationsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CombinationsTests.swift; sourceTree = "<group>"; };
4347CF0D2CE1D56C00CD2979 /* CompactedTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CompactedTests.swift; sourceTree = "<group>"; };
4347CF0E2CE1D56C00CD2979 /* CycleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CycleTests.swift; sourceTree = "<group>"; };
4347CF0F2CE1D56C00CD2979 /* FirstNonNilTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstNonNilTests.swift; sourceTree = "<group>"; };
4347CF102CE1D56C00CD2979 /* GroupedTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupedTests.swift; sourceTree = "<group>"; };
4347CF112CE1D56C00CD2979 /* IndexedTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IndexedTests.swift; sourceTree = "<group>"; };
4347CF122CE1D56C00CD2979 /* IntersperseTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IntersperseTests.swift; sourceTree = "<group>"; };
4347CF132CE1D56C00CD2979 /* JoinedTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoinedTests.swift; sourceTree = "<group>"; };
4347CF142CE1D56C00CD2979 /* KeyedTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyedTests.swift; sourceTree = "<group>"; };
4347CF152CE1D56C00CD2979 /* MinMaxTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MinMaxTests.swift; sourceTree = "<group>"; };
4347CF162CE1D56C00CD2979 /* PartitionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PartitionTests.swift; sourceTree = "<group>"; };
4347CF172CE1D56C00CD2979 /* PermutationsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermutationsTests.swift; sourceTree = "<group>"; };
4347CF182CE1D56C00CD2979 /* ProductTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductTests.swift; sourceTree = "<group>"; };
4347CF192CE1D56C00CD2979 /* RandomSampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RandomSampleTests.swift; sourceTree = "<group>"; };
4347CF1A2CE1D56C00CD2979 /* ReductionsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReductionsTests.swift; sourceTree = "<group>"; };
4347CF1B2CE1D56C00CD2979 /* RotateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RotateTests.swift; sourceTree = "<group>"; };
4347CF1C2CE1D56C00CD2979 /* SplitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SplitTests.swift; sourceTree = "<group>"; };
4347CF1D2CE1D56C00CD2979 /* StrideTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StrideTests.swift; sourceTree = "<group>"; };
4347CF1E2CE1D56C00CD2979 /* SuffixTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SuffixTests.swift; sourceTree = "<group>"; };
4347CF1F2CE1D56C00CD2979 /* TestUtilities.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestUtilities.swift; sourceTree = "<group>"; };
4347CF202CE1D56C00CD2979 /* TrimTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrimTests.swift; sourceTree = "<group>"; };
4347CF212CE1D56C00CD2979 /* UniquePermutationsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UniquePermutationsTests.swift; sourceTree = "<group>"; };
4347CF222CE1D56C00CD2979 /* UniqueTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UniqueTests.swift; sourceTree = "<group>"; };
4347CF232CE1D56C00CD2979 /* WindowsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowsTests.swift; sourceTree = "<group>"; };
7D489E3F29CE969D00499B21 /* Algorithms.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Algorithms.framework; sourceTree = BUILT_PRODUCTS_DIR; };
7D489E4729CE969D00499B21 /* AlgorithmsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AlgorithmsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
7D489ED629CE96DA00499B21 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
7D489F6F29CE986A00499B21 /* Shared.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Shared.xcconfig; sourceTree = "<group>"; };
7D489F7029CE986A00499B21 /* Algorithms.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Algorithms.xcconfig; sourceTree = "<group>"; };
7D489F7129CE986A00499B21 /* AlgorithmsTests.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AlgorithmsTests.xcconfig; sourceTree = "<group>"; };
BB63DC6A29D782010054E9C2 /* Algorithms.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = Algorithms.xctestplan; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
7D489E3C29CE969D00499B21 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
7D489E4429CE969D00499B21 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
7D489E4829CE969D00499B21 /* Algorithms.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
4347CEA92CE1D54900CD2979 /* Algorithms */ = {
isa = PBXGroup;
children = (
4347CE8D2CE1D54900CD2979 /* AdjacentPairs.swift */,
4347CE8E2CE1D54900CD2979 /* Chain.swift */,
4347CE8F2CE1D54900CD2979 /* Chunked.swift */,
4347CE902CE1D54900CD2979 /* Combinations.swift */,
4347CE912CE1D54900CD2979 /* Compacted.swift */,
4347CE922CE1D54900CD2979 /* Cycle.swift */,
4347CE932CE1D54900CD2979 /* Documentation.docc */,
4347CE942CE1D54900CD2979 /* EitherSequence.swift */,
4347CE952CE1D54900CD2979 /* FirstNonNil.swift */,
4347CE962CE1D54900CD2979 /* FlattenCollection.swift */,
4347CE972CE1D54900CD2979 /* Grouped.swift */,
4347CE982CE1D54900CD2979 /* Indexed.swift */,
4347CE992CE1D54900CD2979 /* Intersperse.swift */,
4347CE9A2CE1D54900CD2979 /* Joined.swift */,
4347CE9B2CE1D54900CD2979 /* Keyed.swift */,
4347CE9C2CE1D54900CD2979 /* MinMax.swift */,
4347CE9D2CE1D54900CD2979 /* Partition.swift */,
4347CE9E2CE1D54900CD2979 /* Permutations.swift */,
4347CE9F2CE1D54900CD2979 /* Product.swift */,
4347CEA02CE1D54900CD2979 /* RandomSample.swift */,
4347CEA12CE1D54900CD2979 /* Reductions.swift */,
4347CEA22CE1D54900CD2979 /* Rotate.swift */,
4347CEA32CE1D54900CD2979 /* Split.swift */,
4347CEA42CE1D54900CD2979 /* Stride.swift */,
4347CEA52CE1D54900CD2979 /* Suffix.swift */,
4347CEA62CE1D54900CD2979 /* Trim.swift */,
4347CEA72CE1D54900CD2979 /* Unique.swift */,
4347CEA82CE1D54900CD2979 /* Windows.swift */,
);
path = Algorithms;
sourceTree = "<group>";
};
4347CEAA2CE1D54900CD2979 /* Sources */ = {
isa = PBXGroup;
children = (
4347CEA92CE1D54900CD2979 /* Algorithms */,
);
name = Sources;
path = ../Sources;
sourceTree = SOURCE_ROOT;
};
4347CEC92CE1D54900CD2979 /* Tools */ = {
isa = PBXGroup;
children = (
4347CEC82CE1D54900CD2979 /* swift-algorithms.xcworkspace */,
);
name = Tools;
path = ../Tools;
sourceTree = SOURCE_ROOT;
};
4347CF242CE1D56C00CD2979 /* SwiftAlgorithmsTests */ = {
isa = PBXGroup;
children = (
4347CF092CE1D56C00CD2979 /* AdjacentPairsTests.swift */,
4347CF0A2CE1D56C00CD2979 /* ChainTests.swift */,
4347CF0B2CE1D56C00CD2979 /* ChunkedTests.swift */,
4347CF0C2CE1D56C00CD2979 /* CombinationsTests.swift */,
4347CF0D2CE1D56C00CD2979 /* CompactedTests.swift */,
4347CF0E2CE1D56C00CD2979 /* CycleTests.swift */,
4347CF0F2CE1D56C00CD2979 /* FirstNonNilTests.swift */,
4347CF102CE1D56C00CD2979 /* GroupedTests.swift */,
4347CF112CE1D56C00CD2979 /* IndexedTests.swift */,
4347CF122CE1D56C00CD2979 /* IntersperseTests.swift */,
4347CF132CE1D56C00CD2979 /* JoinedTests.swift */,
4347CF142CE1D56C00CD2979 /* KeyedTests.swift */,
4347CF152CE1D56C00CD2979 /* MinMaxTests.swift */,
4347CF162CE1D56C00CD2979 /* PartitionTests.swift */,
4347CF172CE1D56C00CD2979 /* PermutationsTests.swift */,
4347CF182CE1D56C00CD2979 /* ProductTests.swift */,
4347CF192CE1D56C00CD2979 /* RandomSampleTests.swift */,
4347CF1A2CE1D56C00CD2979 /* ReductionsTests.swift */,
4347CF1B2CE1D56C00CD2979 /* RotateTests.swift */,
4347CF1C2CE1D56C00CD2979 /* SplitTests.swift */,
4347CF1D2CE1D56C00CD2979 /* StrideTests.swift */,
4347CF1E2CE1D56C00CD2979 /* SuffixTests.swift */,
4347CF1F2CE1D56C00CD2979 /* TestUtilities.swift */,
4347CF202CE1D56C00CD2979 /* TrimTests.swift */,
4347CF212CE1D56C00CD2979 /* UniquePermutationsTests.swift */,
4347CF222CE1D56C00CD2979 /* UniqueTests.swift */,
4347CF232CE1D56C00CD2979 /* WindowsTests.swift */,
);
path = SwiftAlgorithmsTests;
sourceTree = "<group>";
};
4347CF252CE1D56C00CD2979 /* Tests */ = {
isa = PBXGroup;
children = (
4347CF242CE1D56C00CD2979 /* SwiftAlgorithmsTests */,
);
name = Tests;
path = ../Tests;
sourceTree = SOURCE_ROOT;
};
7D489E3529CE969D00499B21 = {
isa = PBXGroup;
children = (
4347CE862CE1D54900CD2979 /* CHANGELOG.md */,
4347CE872CE1D54900CD2979 /* CODE_OF_CONDUCT.md */,
4347CE882CE1D54900CD2979 /* CONTRIBUTING.md */,
4347CE892CE1D54900CD2979 /* LICENSE.txt */,
4347CE8A2CE1D54900CD2979 /* Package.resolved */,
4347CE8B2CE1D54900CD2979 /* Package.swift */,
4347CE8C2CE1D54900CD2979 /* README.md */,
4347CEAA2CE1D54900CD2979 /* Sources */,
4347CF252CE1D56C00CD2979 /* Tests */,
4347CEC92CE1D54900CD2979 /* Tools */,
7D489ED229CE96DA00499B21 /* Xcode */,
7D489E4029CE969D00499B21 /* Products */,
);
sourceTree = "<group>";
tabWidth = 8;
};
7D489E4029CE969D00499B21 /* Products */ = {
isa = PBXGroup;
children = (
7D489E3F29CE969D00499B21 /* Algorithms.framework */,
7D489E4729CE969D00499B21 /* AlgorithmsTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
7D489ED229CE96DA00499B21 /* Xcode */ = {
isa = PBXGroup;
children = (
BB63DC6A29D782010054E9C2 /* Algorithms.xctestplan */,
7D489F6F29CE986A00499B21 /* Shared.xcconfig */,
7D489F7029CE986A00499B21 /* Algorithms.xcconfig */,
7D489F7129CE986A00499B21 /* AlgorithmsTests.xcconfig */,
7D489ED629CE96DA00499B21 /* README.md */,
);
name = Xcode;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
7D489E3A29CE969D00499B21 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
7D489E3E29CE969D00499B21 /* Algorithms */ = {
isa = PBXNativeTarget;
buildConfigurationList = 7D489E5129CE969D00499B21 /* Build configuration list for PBXNativeTarget "Algorithms" */;
buildPhases = (
7D489E3A29CE969D00499B21 /* Headers */,
7D489E3B29CE969D00499B21 /* Sources */,
7D489E3C29CE969D00499B21 /* Frameworks */,
7D489E3D29CE969D00499B21 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = Algorithms;
productName = Algorithms;
productReference = 7D489E3F29CE969D00499B21 /* Algorithms.framework */;
productType = "com.apple.product-type.framework";
};
7D489E4629CE969D00499B21 /* AlgorithmsTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 7D489E5429CE969D00499B21 /* Build configuration list for PBXNativeTarget "AlgorithmsTests" */;
buildPhases = (
7D489E4329CE969D00499B21 /* Sources */,
7D489E4429CE969D00499B21 /* Frameworks */,
7D489E4529CE969D00499B21 /* Resources */,
);
buildRules = (
);
dependencies = (
7D489E4A29CE969D00499B21 /* PBXTargetDependency */,
);
name = AlgorithmsTests;
productName = AlgorithmsTests;
productReference = 7D489E4729CE969D00499B21 /* AlgorithmsTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
7D489E3629CE969D00499B21 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1420;
LastUpgradeCheck = 1500;
TargetAttributes = {
7D489E3E29CE969D00499B21 = {
CreatedOnToolsVersion = 14.2;
LastSwiftMigration = 1420;
};
7D489E4629CE969D00499B21 = {
CreatedOnToolsVersion = 14.2;
};
};
};
buildConfigurationList = 7D489E3929CE969D00499B21 /* Build configuration list for PBXProject "Algorithms" */;
compatibilityVersion = "Xcode 15.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 7D489E3529CE969D00499B21;
productRefGroup = 7D489E4029CE969D00499B21 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
7D489E3E29CE969D00499B21 /* Algorithms */,
7D489E4629CE969D00499B21 /* AlgorithmsTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
7D489E3D29CE969D00499B21 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
7D489E4529CE969D00499B21 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
7D489E3B29CE969D00499B21 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4347CECC2CE1D54900CD2979 /* Suffix.swift in Sources */,
4347CECD2CE1D54900CD2979 /* Chunked.swift in Sources */,
4347CECE2CE1D54900CD2979 /* Keyed.swift in Sources */,
4347CECF2CE1D54900CD2979 /* Stride.swift in Sources */,
4347CED02CE1D54900CD2979 /* Windows.swift in Sources */,
4347CED32CE1D54900CD2979 /* Partition.swift in Sources */,
4347CED52CE1D54900CD2979 /* FirstNonNil.swift in Sources */,
4347CED62CE1D54900CD2979 /* Rotate.swift in Sources */,
4347CEDF2CE1D54900CD2979 /* Split.swift in Sources */,
4347CEE02CE1D54900CD2979 /* Chain.swift in Sources */,
4347CEE12CE1D54900CD2979 /* Trim.swift in Sources */,
4347CEE22CE1D54900CD2979 /* Product.swift in Sources */,
4347CEE42CE1D54900CD2979 /* Indexed.swift in Sources */,
4347CEE52CE1D54900CD2979 /* Documentation.docc in Sources */,
4347CEE82CE1D54900CD2979 /* Combinations.swift in Sources */,
4347CEE92CE1D54900CD2979 /* MinMax.swift in Sources */,
4347CEEA2CE1D54900CD2979 /* Joined.swift in Sources */,
4347CEEB2CE1D54900CD2979 /* Grouped.swift in Sources */,
4347CEED2CE1D54900CD2979 /* AdjacentPairs.swift in Sources */,
4347CEEE2CE1D54900CD2979 /* Permutations.swift in Sources */,
4347CEF02CE1D54900CD2979 /* FlattenCollection.swift in Sources */,
4347CEF32CE1D54900CD2979 /* Reductions.swift in Sources */,
4347CEF42CE1D54900CD2979 /* Intersperse.swift in Sources */,
4347CEF52CE1D54900CD2979 /* RandomSample.swift in Sources */,
4347CEFB2CE1D54900CD2979 /* Unique.swift in Sources */,
4347CEFD2CE1D54900CD2979 /* EitherSequence.swift in Sources */,
4347CEFE2CE1D54900CD2979 /* Cycle.swift in Sources */,
4347CEFF2CE1D54900CD2979 /* Compacted.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
7D489E4329CE969D00499B21 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4347CF262CE1D56C00CD2979 /* IndexedTests.swift in Sources */,
4347CF272CE1D56C00CD2979 /* RotateTests.swift in Sources */,
4347CF282CE1D56C00CD2979 /* RandomSampleTests.swift in Sources */,
4347CF292CE1D56C00CD2979 /* StrideTests.swift in Sources */,
4347CF2A2CE1D56C00CD2979 /* IntersperseTests.swift in Sources */,
4347CF2B2CE1D56C00CD2979 /* CombinationsTests.swift in Sources */,
4347CF2C2CE1D56C00CD2979 /* SplitTests.swift in Sources */,
4347CF2D2CE1D56C00CD2979 /* ReductionsTests.swift in Sources */,
4347CF2E2CE1D56C00CD2979 /* TrimTests.swift in Sources */,
4347CF2F2CE1D56C00CD2979 /* FirstNonNilTests.swift in Sources */,
4347CF302CE1D56C00CD2979 /* SuffixTests.swift in Sources */,
4347CF312CE1D56C00CD2979 /* KeyedTests.swift in Sources */,
4347CF322CE1D56C00CD2979 /* UniqueTests.swift in Sources */,
4347CF332CE1D56C00CD2979 /* PermutationsTests.swift in Sources */,
4347CF342CE1D56C00CD2979 /* CompactedTests.swift in Sources */,
4347CF352CE1D56C00CD2979 /* UniquePermutationsTests.swift in Sources */,
4347CF362CE1D56C00CD2979 /* GroupedTests.swift in Sources */,
4347CF372CE1D56C00CD2979 /* MinMaxTests.swift in Sources */,
4347CF382CE1D56C00CD2979 /* ProductTests.swift in Sources */,
4347CF392CE1D56C00CD2979 /* ChainTests.swift in Sources */,
4347CF3A2CE1D56C00CD2979 /* ChunkedTests.swift in Sources */,
4347CF3B2CE1D56C00CD2979 /* PartitionTests.swift in Sources */,
4347CF3C2CE1D56C00CD2979 /* CycleTests.swift in Sources */,
4347CF3D2CE1D56C00CD2979 /* AdjacentPairsTests.swift in Sources */,
4347CF3E2CE1D56C00CD2979 /* TestUtilities.swift in Sources */,
4347CF3F2CE1D56C00CD2979 /* WindowsTests.swift in Sources */,
4347CF402CE1D56C00CD2979 /* JoinedTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
7D489E4A29CE969D00499B21 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 7D489E3E29CE969D00499B21 /* Algorithms */;
targetProxy = 7D489E4929CE969D00499B21 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
7D489E4F29CE969D00499B21 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7D489F6F29CE986A00499B21 /* Shared.xcconfig */;
buildSettings = {
};
name = Debug;
};
7D489E5029CE969D00499B21 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7D489F6F29CE986A00499B21 /* Shared.xcconfig */;
buildSettings = {
};
name = Release;
};
7D489E5229CE969D00499B21 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7D489F7029CE986A00499B21 /* Algorithms.xcconfig */;
buildSettings = {
};
name = Debug;
};
7D489E5329CE969D00499B21 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7D489F7029CE986A00499B21 /* Algorithms.xcconfig */;
buildSettings = {
};
name = Release;
};
7D489E5529CE969D00499B21 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7D489F7129CE986A00499B21 /* AlgorithmsTests.xcconfig */;
buildSettings = {
};
name = Debug;
};
7D489E5629CE969D00499B21 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7D489F7129CE986A00499B21 /* AlgorithmsTests.xcconfig */;
buildSettings = {
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
7D489E3929CE969D00499B21 /* Build configuration list for PBXProject "Algorithms" */ = {
isa = XCConfigurationList;
buildConfigurations = (
7D489E4F29CE969D00499B21 /* Debug */,
7D489E5029CE969D00499B21 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
7D489E5129CE969D00499B21 /* Build configuration list for PBXNativeTarget "Algorithms" */ = {
isa = XCConfigurationList;
buildConfigurations = (
7D489E5229CE969D00499B21 /* Debug */,
7D489E5329CE969D00499B21 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
7D489E5429CE969D00499B21 /* Build configuration list for PBXNativeTarget "AlgorithmsTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
7D489E5529CE969D00499B21 /* Debug */,
7D489E5629CE969D00499B21 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 7D489E3629CE969D00499B21 /* Project object */;
}
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7D489E3E29CE969D00499B21"
BuildableName = "Algorithms.framework"
BlueprintName = "Algorithms"
ReferencedContainer = "container:Algorithms.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<TestPlans>
<TestPlanReference
reference = "container:Algorithms.xctestplan"
default = "YES">
</TestPlanReference>
</TestPlans>
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7D489E4629CE969D00499B21"
BuildableName = "AlgorithmsTests.xctest"
BlueprintName = "AlgorithmsTests"
ReferencedContainer = "container:Algorithms.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7D489E3E29CE969D00499B21"
BuildableName = "Algorithms.framework"
BlueprintName = "Algorithms"
ReferencedContainer = "container:Algorithms.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
+32
View File
@@ -0,0 +1,32 @@
{
"configurations" : [
{
"id" : "CF37E70B-D810-4CF2-AB41-571BAFF72572",
"name" : "Default",
"options" : {
}
},
{
"id" : "33436295-E24E-439B-9B8E-4602E0A6C8BB",
"name" : "TSan",
"options" : {
"threadSanitizerEnabled" : true
}
}
],
"defaultOptions" : {
"codeCoverage" : false
},
"testTargets" : [
{
"parallelizable" : true,
"target" : {
"containerPath" : "container:Algorithms.xcodeproj",
"identifier" : "7D489E4629CE969D00499B21",
"name" : "AlgorithmsTests"
}
}
],
"version" : 1
}
+23
View File
@@ -0,0 +1,23 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Algorithms open source project
//
// Copyright (c) 2023 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
//
//===----------------------------------------------------------------------===//
PRODUCT_NAME = AlgorithmsTests
PRODUCT_BUNDLE_IDENTIFIER = org.swift.AlgorithmsTests
SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator watchos watchsimulator appletvos appletvsimulator
ARCHS = $(ARCHS_STANDARD)
CURRENT_PROJECT_VERSION = 1
MARKETING_VERSION = 1.0
GENERATE_INFOPLIST_FILE = YES
ENABLE_TESTABILITY = NO
+5
View File
@@ -0,0 +1,5 @@
# Xcode build files
The project file here can be used to build a variant of this package with Xcode, producing a single framework bundle. Build settings are entirely configured via the provided xcconfig files.
Beware! The contents of this directory are not source stable. They are provided as is, with no compatibility promises across package releases. Future versions of this package can arbitrarily change these files or remove them, without any advance notice. (This can include patch releases.)
+88
View File
@@ -0,0 +1,88 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift Algorithms open source project
//
// Copyright (c) 2023 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
//
//===----------------------------------------------------------------------===//
SDKROOT = macosx
CODE_SIGN_STYLE = Automatic
CODE_SIGN_IDENTITY = -
CODE_SIGN_IDENTITY[sdk=iphoneos*] = "iOS Developer"
CODE_SIGN_IDENTITY[sdk=watchos*] = "iOS Developer"
CODE_SIGN_IDENTITY[sdk=appletvos*] = "iOS Developer"
SWIFT_VERSION = 5.5
ONLY_ACTIVE_ARCH[config=Debug] = YES
SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(inherited) ALGORITHMS_DARWIN_ONLY
SWIFT_COMPILATION_MODE[config=Release] = wholemodule
SWIFT_COMPILATION_MODE[config=Debug] = singlefile
SWIFT_OPTIMIZATION_LEVEL[config=Release] = -O
SWIFT_OPTIMIZATION_LEVEL[config=Debug] = -Onone
SWIFT_EMIT_LOC_STRINGS = NO
SWIFT_INSTALL_OBJC_HEADER = NO
COPY_PHASE_STRIP = NO
DEBUG_INFORMATION_FORMAT[config=Release] = dwarf-with-dsym
DEBUG_INFORMATION_FORMAT[config=Debug] = dwarf
ALWAYS_SEARCH_USER_PATHS = NO
ENABLE_TESTABILITY = NO
ENABLE_USER_SCRIPT_SANDBOXING = YES
DEAD_CODE_STRIPPING = YES
GCC_DYNAMIC_NO_PIC = NO
GCC_NO_COMMON_BLOCKS = YES
GCC_OPTIMIZATION_LEVEL[config=Debug] = 0
GCC_C_LANGUAGE_STANDARD = gnu11
CLANG_CXX_LANGUAGE_STANDARD = gnu++20
CLANG_ENABLE_MODULES = YES
CLANG_ENABLE_OBJC_ARC = YES
CLANG_ENABLE_OBJC_WEAK = YES
ENABLE_NS_ASSERTIONS[config=Release] = NO
ENABLE_STRICT_OBJC_MSGSEND = YES
GCC_PREPROCESSOR_DEFINITIONS[config=Release] = DEBUG=1 $(inherited)
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES
CLANG_WARN_BOOL_CONVERSION = YES
CLANG_WARN_COMMA = YES
CLANG_WARN_CONSTANT_CONVERSION = YES
CLANG_WARN_DOCUMENTATION_COMMENTS = YES
CLANG_WARN_EMPTY_BODY = YES
CLANG_WARN_ENUM_CONVERSION = YES
CLANG_WARN_INFINITE_RECURSION = YES
CLANG_WARN_INT_CONVERSION = YES
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES
CLANG_WARN_STRICT_PROTOTYPES = YES
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
CLANG_WARN_UNREACHABLE_CODE = YES
GCC_WARN_64_TO_32_BIT_CONVERSION = YES
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE
GCC_WARN_UNUSED_FUNCTION = YES
GCC_WARN_UNUSED_VARIABLE = YES
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES
CLANG_WARN_SUSPICIOUS_MOVE = YES
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
GCC_WARN_UNDECLARED_SELECTOR = YES
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
CLANG_ANALYZER_NONNULL = YES
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE