mirror of
https://github.com/apple/swift-algorithms
synced 2026-11-22 04:10:39 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87e50f483c | ||
|
|
cdc909b93d | ||
|
|
acb4100b54 | ||
|
|
34eec0dd27 | ||
|
|
09dc5e4354 | ||
|
|
0a01f21eae | ||
|
|
34b1705efd | ||
|
|
ae92f2b33f | ||
|
|
33abb69428 | ||
|
|
82ee335a48 | ||
|
|
9e3900be49 | ||
|
|
9dd88e5eaf | ||
|
|
c3b3acbca3 | ||
|
|
f6919dfc30 | ||
|
|
f2fd047eed | ||
|
|
5c54f200e7 | ||
|
|
2e71e228c0 | ||
|
|
328631d60c | ||
|
|
0ebed148c2 | ||
|
|
c8ae549e42 | ||
|
|
dd4e0e70ff |
No files matched your search
+75
-3
@@ -8,11 +8,56 @@ 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
|
||||
|
||||
### 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!
|
||||
|
||||
---
|
||||
|
||||
## [1.1.0] - 2023-08-24
|
||||
## [1.1.0] - 2023-10-05
|
||||
|
||||
### Additions
|
||||
|
||||
@@ -312,7 +357,9 @@ 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.1.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
|
||||
[0.2.1]: https://github.com/apple/swift-algorithms/compare/0.2.0...0.2.1
|
||||
@@ -354,31 +401,54 @@ This changelog's format is based on [Keep a Changelog](https://keepachangelog.co
|
||||
[#138]: https://github.com/apple/swift-algorithms/pull/138
|
||||
[#152]: https://github.com/apple/swift-algorithms/pull/152
|
||||
[#162]: https://github.com/apple/swift-algorithms/pull/162
|
||||
[#197]: https://github.com/apple/swift-algorithms/pull/197
|
||||
[#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
|
||||
@@ -386,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
|
||||
@@ -393,3 +464,4 @@ This changelog's format is based on [Keep a Changelog](https://keepachangelog.co
|
||||
[stephentyrone]: https://github.com/apple/swift-algorithms/commits?author=stephentyrone
|
||||
[timvermeulen]: https://github.com/apple/swift-algorithms/commits?author=timvermeulen
|
||||
[toddthomas]: https://github.com/apple/swift-algorithms/commits?author=toddthomas
|
||||
[ttsugriy]: https://github.com/apple/swift-algorithms/commits?author=ttsugriy
|
||||
@@ -5,9 +5,6 @@
|
||||
|
||||
Lazily iterates over tuples of adjacent elements.
|
||||
|
||||
This operation is available for any sequence by calling the `adjacentPairs()`
|
||||
method.
|
||||
|
||||
```swift
|
||||
let numbers = (1...5)
|
||||
let pairs = numbers.adjacentPairs()
|
||||
|
||||
@@ -86,7 +86,7 @@ call to `CombinationsSequence.Iterator.next()` is an O(_n_) operation.
|
||||
### Naming
|
||||
|
||||
The parameter label in `combination(ofCount:)` is the best match for the
|
||||
Swift API guidelines. A few other options were considered:
|
||||
[Swift's API Design Guidelines](https://www.swift.org/documentation/api-design-guidelines/). A few other options were considered:
|
||||
|
||||
- When the standard library uses `of` as a label, the parameter is generally
|
||||
the object of the operation, as in `type(of:)` and `firstIndex(of:)`, and
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
# Grouped
|
||||
|
||||
[[Source](https://github.com/apple/swift-algorithms/blob/main/Sources/Algorithms/Grouped.swift) |
|
||||
[Tests](https://github.com/apple/swift-algorithms/blob/main/Tests/SwiftAlgorithmsTests/GroupedTests.swift)]
|
||||
|
||||
Groups up elements of a sequence into a new Dictionary, whose values are Arrays of grouped elements, each keyed by the result of the given closure.
|
||||
|
||||
```swift
|
||||
let fruits = ["Apricot", "Banana", "Apple", "Cherry", "Avocado", "Coconut"]
|
||||
let fruitsByLetter = fruits.grouped(by: { $0.first! })
|
||||
// Results in:
|
||||
// [
|
||||
// "B": ["Banana"],
|
||||
// "A": ["Apricot", "Apple", "Avocado"],
|
||||
// "C": ["Cherry", "Coconut"],
|
||||
// ]
|
||||
```
|
||||
|
||||
If you wish to achieve a similar effect but for single values (instead of Arrays of grouped values), see [`keyed(by:)`](Keyed.md).
|
||||
|
||||
## Detailed Design
|
||||
|
||||
The `grouped(by:)` method is declared as a `Sequence` extension returning
|
||||
`[GroupKey: [Element]]`.
|
||||
|
||||
```swift
|
||||
extension Sequence {
|
||||
public func grouped<GroupKey>(
|
||||
by keyForValue: (Element) throws -> GroupKey
|
||||
) rethrows -> [GroupKey: [Element]]
|
||||
}
|
||||
```
|
||||
|
||||
### Complexity
|
||||
|
||||
Calling `grouped(by:)` is an O(_n_) operation.
|
||||
|
||||
### Comparison with other languages
|
||||
|
||||
| Language | Grouping API |
|
||||
|---------------|--------------|
|
||||
| Java | [`groupingBy`](https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/util/stream/Collectors.html#groupingBy(java.util.function.Function)) |
|
||||
| Kotlin | [`groupBy`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/group-by.html) |
|
||||
| C# | [`GroupBy`](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.groupby?view=net-7.0#system-linq-enumerable-groupby) |
|
||||
| Rust | [`group_by`](https://doc.rust-lang.org/std/primitive.slice.html#method.group_by) |
|
||||
| Ruby | [`group_by`](https://ruby-doc.org/3.2.2/Enumerable.html#method-i-group_by) |
|
||||
| Python | [`groupby`](https://docs.python.org/3/library/itertools.html#itertools.groupby) |
|
||||
| PHP (Laravel) | [`groupBy`](https://laravel.com/docs/10.x/collections#method-groupby) |
|
||||
|
||||
#### Naming
|
||||
|
||||
All the surveyed languages name this operation with a variant of "grouped" or "grouping". The past tense `grouped(by:)` best fits [Swift's API Design Guidelines](https://www.swift.org/documentation/api-design-guidelines/).
|
||||
|
||||
#### Customization points
|
||||
|
||||
Java and C# are interesting in that they provide multiple overloads with several points of customization:
|
||||
|
||||
1. Changing the type of the groups.
|
||||
1. E.g. the groups can be Sets instead of Arrays.
|
||||
1. Akin to calling `.transformValues { group in Set(group) }` on the resultant dictionary, but avoiding the intermediate allocation of Arrays of each group.
|
||||
2. Picking which elements end up in the groupings.
|
||||
1. The default is the elements of the input sequence, but can be changed.
|
||||
2. Akin to calling `.transformValues { group in group.map(someTransform) }` on the resultant dictionary, but avoiding the intermediate allocation of Arrays of each group.
|
||||
3. Changing the type of the outermost collection.
|
||||
1. E.g using an `OrderedDictionary`, `SortedDictionary` or `TreeDictionary` instead of the default (hashed, unordered) `Dictionary`.
|
||||
2. There's no great way to achieve this with the `grouped(by:)`. One could wrap the resultant dictionary in an initializer to one of the other dictionary types, but that isn't sufficient: Once the `Dictionary` loses the ordering, there's no way to get it back when constructing one of the ordered dictionary variants.
|
||||
|
||||
It is not clear which of these points of customization are worth supporting, or what the best way to express them might be.
|
||||
@@ -0,0 +1,78 @@
|
||||
# Keyed
|
||||
|
||||
[[Source](https://github.com/apple/swift-algorithms/blob/main/Sources/Algorithms/Keyed.swift) |
|
||||
[Tests](https://github.com/apple/swift-algorithms/blob/main/Tests/SwiftAlgorithmsTests/KeyedTests.swift)]
|
||||
|
||||
Stores the elements of a sequence as the values of a Dictionary, keyed by the result of the given closure.
|
||||
|
||||
```swift
|
||||
let fruits = ["Apricot", "Banana", "Apple", "Cherry", "Blackberry", "Avocado", "Coconut"]
|
||||
let fruitByLetter = fruits.keyed(by: { $0.first! })
|
||||
// Results in:
|
||||
// [
|
||||
// "A": "Avocado",
|
||||
// "B": "Blackberry",
|
||||
// "C": "Coconut",
|
||||
// ]
|
||||
```
|
||||
|
||||
On a key-collision, the latest element is kept by default. Alternatively, you can provide a closure which specifies which value to keep:
|
||||
|
||||
```swift
|
||||
let fruits = ["Apricot", "Banana", "Apple", "Cherry", "Blackberry", "Avocado", "Coconut"]
|
||||
let fruitsByLetter = fruits.keyed(
|
||||
by: { $0.first! },
|
||||
resolvingConflictsWith: { key, old, new in old } // Always pick the first fruit
|
||||
)
|
||||
// Results in:
|
||||
// [
|
||||
// "A": "Apricot",
|
||||
// "B": "Banana",
|
||||
// "C": "Cherry",
|
||||
// ]
|
||||
```
|
||||
|
||||
## Detailed Design
|
||||
|
||||
The `keyed(by:)` and `keyed(by:resolvingConflictsWith:)` methods are declared in an `Sequence` extension, both returning `[Key: Element]`.
|
||||
|
||||
```swift
|
||||
extension Sequence {
|
||||
public func keyed<Key>(
|
||||
by keyForValue: (Element) throws -> Key
|
||||
) rethrows -> [Key: Element]
|
||||
|
||||
public func keyed<Key>(
|
||||
by keyForValue: (Element) throws -> Key,
|
||||
resolvingConflictsWith resolve: ((Key, Element, Element) throws -> Element)? = nil
|
||||
) rethrows -> [Key: Element]
|
||||
}
|
||||
```
|
||||
|
||||
### Complexity
|
||||
|
||||
Calling `keyed(by:)` is an O(_n_) operation.
|
||||
|
||||
### Comparison with other languages
|
||||
|
||||
| Language | "Keying" API |
|
||||
|---------------|-------------|
|
||||
| Java | [`toMap`](https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/util/stream/Collectors.html#toMap(java.util.function.Function,java.util.function.Function)) |
|
||||
| Kotlin | [`associatedBy`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/associate-by.html) |
|
||||
| C# | [`ToDictionary`](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.todictionary?view=net-7.0#system-linq-enumerable-todictionary) |
|
||||
| Ruby (ActiveSupport) | [`index_by`](https://rubydoc.info/gems/activesupport/7.0.5/Enumerable#index_by-instance_method) |
|
||||
| PHP (Laravel) | [`keyBy`](https://laravel.com/docs/10.x/collections#method-keyby) |
|
||||
|
||||
#### Rejected alternative names
|
||||
|
||||
1. Java's `toMap` is referring to `Map`/`HashMap`, their naming for Dictionaries and other associative collections. It's easy to confuse with the transformation function, `Sequence.map(_:)`.
|
||||
2. C#'s `toXXX()` naming doesn't suite Swift well, which tends to prefer `Foo.init` over `toFoo()` methods.
|
||||
3. Ruby's `index_by` naming doesn't fit Swift well, where "index" is a specific term (e.g. the `associatedtype Index` on `Collection`). There is also a [`index(by:)`](Index.md) method in swift-algorithms, is specifically to do with matching elements up with their indices, and not any arbitrary derived value.
|
||||
|
||||
#### Alternative names
|
||||
|
||||
Kotlin's `associatedBy` naming is a good alternative, and matches the past tense of [Swift's API Design Guidelines](https://www.swift.org/documentation/api-design-guidelines/), though perhaps we'd spell it `associated(by:)`.
|
||||
|
||||
#### Customization points
|
||||
|
||||
Java and C# are interesting in that they provide overloads that let you customize the type of the outermost collection. E.g. using an `OrderedDictionary` instead of the default (hashed, unordered) `Dictionary`.
|
||||
@@ -0,0 +1,53 @@
|
||||
# Guides
|
||||
|
||||
These guides describe the design and intention behind the APIs included in the `Algorithms` library. For further reading, see the [announcement on swift.org](https://swift.org/blog/swift-algorithms/) and the [official documentation](https://swiftpackageindex.com/apple/swift-algorithms/documentation/algorithms).
|
||||
|
||||
## Contents
|
||||
|
||||
#### Combinations / permutations
|
||||
|
||||
- [`combinations(ofCount:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Combinations.md): Combinations of particular sizes of the elements in a collection.
|
||||
- [`permutations(ofCount:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Permutations.md): Permutations of a particular size of the elements in a collection, or of the full collection.
|
||||
- [`uniquePermutations(ofCount:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Permutations.md): Permutations of a collection's elements, skipping any duplicate permutations.
|
||||
|
||||
#### Mutating algorithms
|
||||
|
||||
- [`rotate(toStartAt:)`, `rotate(subrange:toStartAt:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Rotate.md): In-place rotation of elements.
|
||||
- [`stablePartition(by:)`, `stablePartition(subrange:by:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Partition.md): A partition that preserves the relative order of the resulting prefix and suffix.
|
||||
|
||||
#### Combining collections
|
||||
|
||||
- [`chain(_:_:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Chain.md): Concatenates two collections with the same element type.
|
||||
- [`cycled()`, `cycled(times:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Cycle.md): Repeats the elements of a collection forever or a set number of times.
|
||||
- [`joined(by:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Joined.md): Concatenate sequences of sequences, using an element or sequence as a separator, or using a closure to generate each separator.
|
||||
- [`product(_:_:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Product.md): Iterates over all the pairs of two collections; equivalent to nested `for`-`in` loops.
|
||||
|
||||
#### Subsetting operations
|
||||
|
||||
- [`compacted()`](https://github.com/apple/swift-algorithms/blob/main/Guides/Compacted.md): Drops the `nil`s from a sequence or collection, unwrapping the remaining elements.
|
||||
- [`partitioned(by:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Partition.md): Returns the elements in a sequence or collection that do and do not match a given predicate.
|
||||
- [`randomSample(count:)`, `randomSample(count:using:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/RandomSampling.md): Randomly selects a specific number of elements from a collection.
|
||||
- [`randomStableSample(count:)`, `randomStableSample(count:using:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/RandomSampling.md): Randomly selects a specific number of elements from a collection, preserving their original relative order.
|
||||
- [`striding(by:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Stride.md): Returns every nth element of a collection.
|
||||
- [`suffix(while:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Suffix.md): Returns the suffix of a collection where all element pass a given predicate.
|
||||
- [`trimmingPrefix(while:)`, `trimmingSuffix(while)`, `trimming(while:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Trim.md): Returns a slice by trimming elements from a collection's start, end, or both. The mutating `trim...` methods trim a collection in place.
|
||||
- [`uniqued()`, `uniqued(on:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Unique.md): The unique elements of a collection, preserving their order.
|
||||
- [`minAndMax()`, `minAndMax(by:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/MinMax.md): Returns the smallest and largest elements of a sequence.
|
||||
|
||||
#### Partial sorting
|
||||
|
||||
- [`min(count:)`, `max(count:)`, `min(count:sortedBy:)`, `max(count:sortedBy:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/MinMax.md): Returns the smallest or largest elements of a collection, sorted by a predicate.
|
||||
|
||||
#### Other useful operations
|
||||
|
||||
- [`adjacentPairs()`](https://github.com/apple/swift-algorithms/blob/main/Guides/AdjacentPairs.md): Lazily iterates over tuples of adjacent elements.
|
||||
- [`chunked(by:)`, `chunked(on:)`, `chunks(ofCount:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Chunked.md): Eager and lazy operations that break a collection into chunks based on either a binary predicate or when the result of a projection changes or chunks of a given count.
|
||||
- [`firstNonNil(_:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/FirstNonNil.md): Returns the first non-`nil` result from transforming a sequence's elements.
|
||||
- [`grouped(by:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Grouped.md): Group up elements using the given closure, returning a Dictionary of those groups, keyed by the results of the closure.
|
||||
- [`indexed()`](https://github.com/apple/swift-algorithms/blob/main/Guides/Indexed.md): Iterate over tuples of a collection's indices and elements.
|
||||
- [`interspersed(with:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Intersperse.md): Place a value between every two elements of a sequence.
|
||||
- [`keyed(by:)`, `keyed(by:resolvingConflictsBy:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Keyed.md): Returns a Dictionary that associates elements of a sequence with the keys returned by the given closure.
|
||||
- [`partitioningIndex(where:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Partition.md): Returns the starting index of the partition of a collection that matches a predicate.
|
||||
- [`reductions(_:)`, `reductions(_:_:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Reductions.md): Returns all the intermediate states of reducing the elements of a sequence or collection.
|
||||
- [`split(maxSplits:omittingEmptySubsequences:whereSeparator)`, `split(separator:maxSplits:omittingEmptySubsequences)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Split.md): Lazy versions of the Standard Library's eager operations that split sequences and collections into subsequences separated by the specified separator element.
|
||||
- [`windows(ofCount:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Windows.md): Breaks a collection into overlapping subsequences where elements are slices from the original collection.
|
||||
+1
-1
@@ -9,7 +9,7 @@ collection until predicate returns `false` and skipping the remaining elements.
|
||||
This example uses `suffix(while: )` to iterate through collection of integers
|
||||
from the end until the predicate returns false, in this case when `$0 <= 5`
|
||||
```swift
|
||||
(0...10).suffix(while: { $0 > 5 } // == [6,7,8,9,10]
|
||||
(0...10).suffix(while: { $0 > 5 }) // == [6,7,8,9,10]
|
||||
```
|
||||
|
||||
## Detailed Design
|
||||
|
||||
+50
-29
@@ -3,8 +3,8 @@
|
||||
[[Source](https://github.com/apple/swift-algorithms/blob/main/Sources/Algorithms/Trim.swift) |
|
||||
[Tests](https://github.com/apple/swift-algorithms/blob/main/Tests/SwiftAlgorithmsTests/TrimTests.swift)]
|
||||
|
||||
Returns a `SubSequence` formed by discarding all elements at the start and end
|
||||
of the collection which satisfy the given predicate.
|
||||
A group of methods that return the `SubSequence` formed by discarding elements
|
||||
at the start and/or end of the collection which satisfy the given predicate.
|
||||
|
||||
This example uses `trimming(while:)` to get a substring without the white space
|
||||
at the beginning and end of the string.
|
||||
@@ -17,24 +17,44 @@ let results = [2, 10, 11, 15, 20, 21, 100].trimming(while: { $0.isMultiple(of: 2
|
||||
print(results) // [11, 15, 20, 21]
|
||||
```
|
||||
|
||||
The `Algorithms` library also includes methods that trim from each end,
|
||||
as well as mutating versions of all three methods.
|
||||
|
||||
## Detailed Design
|
||||
|
||||
A new method is added to `BidirectionalCollection`:
|
||||
New methods are added to `Collection` and `BidirectionalCollection`:
|
||||
|
||||
```swift
|
||||
extension Collection {
|
||||
func trimmingPrefix(while predicate: (Element) throws -> Bool) rethrows -> SubSequence
|
||||
}
|
||||
|
||||
extension BidirectionalCollection {
|
||||
public func trimming(while predicate: (Element) throws -> Bool) rethrows -> SubSequence
|
||||
func trimmingSuffix(while predicate: (Element) throws -> Bool) rethrows -> SubSequence
|
||||
|
||||
func trimming(while predicate: (Element) throws -> Bool) rethrows -> SubSequence
|
||||
}
|
||||
|
||||
extension Collection where Self: RangeReplaceableCollection {
|
||||
mutating func trimPrefix(while predicate: (Element) throws -> Bool) rethrows
|
||||
}
|
||||
|
||||
extension BidirectionalCollection where Self: RangeReplaceableCollection {
|
||||
mutating func trimSuffix(while predicate: (Element) throws -> Bool) rethrows
|
||||
|
||||
mutating func trim(while predicate: (Element) throws -> Bool) rethrows
|
||||
}
|
||||
```
|
||||
|
||||
This method requires `BidirectionalCollection` for an efficient implementation
|
||||
which visits as few elements as possible.
|
||||
There are also overloads of the mutating methods when `Self == Self.SubSequence`,
|
||||
for non-range-replaceable self-slicing types.
|
||||
|
||||
A less-efficient implementation is _possible_ for any `Collection`, which would
|
||||
involve always traversing the entire collection. This implementation is not
|
||||
provided, as it would mean developers of generic algorithms who forget to add
|
||||
the `BidirectionalCollection` constraint will receive that inefficient
|
||||
implementation:
|
||||
Though the `trimming` and `trimmingSuffix` methods are declared on
|
||||
`BidirectionalCollection`, a less-efficient implementation is _possible_ for
|
||||
any `Collection`, which would involve always traversing the entire collection.
|
||||
This implementation is not provided, as it would mean developers of generic
|
||||
algorithms who forget to add the `BidirectionalCollection` constraint will
|
||||
receive that inefficient implementation:
|
||||
|
||||
```swift
|
||||
func myAlgorithm<Input>(input: Input) where Input: Collection {
|
||||
@@ -50,28 +70,29 @@ Swift provides the `BidirectionalCollection` protocol for marking types which
|
||||
support reverse traversal, and generic types and algorithms which want to make
|
||||
use of that should add it to their constraints.
|
||||
|
||||
### >= 0.3.0
|
||||
#### Supporting Methods
|
||||
|
||||
In `v0.3.0` new methods are added to allow discarding all the elements matching
|
||||
the predicate at the beginning (prefix) or at the ending (suffix) of the
|
||||
collection.
|
||||
- `trimmingSuffix(while:)` can only be run on collections conforming to the
|
||||
`BidirectionalCollection` protocol.
|
||||
- `trimmingPrefix(while:)` can be run also on collections conforming to the
|
||||
`Collection` protocol.
|
||||
The `endOfPrefix(while:)` and `startOfSuffix(while:)` methods are used
|
||||
in the implementation of the trimming methods described above. As these
|
||||
supporting methods are independently useful, they are included in the library
|
||||
as well.
|
||||
|
||||
```swift
|
||||
let myString = " hello, world "
|
||||
print(myString.trimmingPrefix(while: \.isWhitespace)) // "hello, world "
|
||||
extension Collection {
|
||||
/// Returns the exclusive upper bound of the prefix of elements that satisfy
|
||||
/// the predicate.
|
||||
func endOfPrefix(
|
||||
while predicate: (Element) throws -> Bool
|
||||
) rethrows -> Index
|
||||
}
|
||||
|
||||
print(myString.trimmingSuffix(while: \.isWhitespace)) // " hello, world"
|
||||
```
|
||||
Also mutating variants for all the methods already existing and the new ones are
|
||||
added.
|
||||
```swift
|
||||
var myString = " hello, world "
|
||||
myString.trim(while: \.isWhitespace)
|
||||
print(myString) // "hello, world"
|
||||
extension BidirectionalCollection {
|
||||
/// Returns the inclusive lower bound of the suffix of elements that satisfy
|
||||
/// the predicate.
|
||||
func startOfSuffix(
|
||||
while predicate: (Element) throws -> Bool
|
||||
) rethrows -> Index
|
||||
}
|
||||
```
|
||||
|
||||
### Complexity
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// swift-tools-version:5.4
|
||||
// swift-tools-version:5.7
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Algorithms open source project
|
||||
|
||||
@@ -2,55 +2,35 @@
|
||||
|
||||
**Swift Algorithms** is an open-source package of sequence and collection algorithms, along with their related types.
|
||||
|
||||
Read more about the package, and the intent behind it, in the [announcement on swift.org](https://swift.org/blog/swift-algorithms/).
|
||||
## Overview
|
||||
|
||||
## Contents
|
||||
The Algorithms package provides a variety of sequence and collection operations, letting you cycle over a collection's elements, find combinations and permutations, create a random sample, and more.
|
||||
|
||||
#### Combinations / permutations
|
||||
For example, the package includes a group of "chunking" methods, each of which breaks a collection into consecutive subsequences. One version tests adjacent elements to find the breaking point between chunks — you can use it to quickly separate an array into ascending runs:
|
||||
|
||||
- [`combinations(ofCount:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Combinations.md): Combinations of particular sizes of the elements in a collection.
|
||||
- [`permutations(ofCount:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Permutations.md): Permutations of a particular size of the elements in a collection, or of the full collection.
|
||||
- [`uniquePermutations(ofCount:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Permutations.md): Permutations of a collection's elements, skipping any duplicate permutations.
|
||||
```swift
|
||||
let numbers = [10, 20, 30, 10, 40, 40, 10, 20]
|
||||
let chunks = numbers.chunked(by: { $0 <= $1 })
|
||||
// [[10, 20, 30], [10, 40, 40], [10, 20]]
|
||||
```
|
||||
|
||||
#### Mutating algorithms
|
||||
Another version looks for a change in the transformation of each successive value. You can use that to separate a list of names into groups by the first character:
|
||||
|
||||
- [`rotate(toStartAt:)`, `rotate(subrange:toStartAt:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Rotate.md): In-place rotation of elements.
|
||||
- [`stablePartition(by:)`, `stablePartition(subrange:by:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Partition.md): A partition that preserves the relative order of the resulting prefix and suffix.
|
||||
```swift
|
||||
let names = ["Cassie", "Chloe", "Jasmine", "Jordan", "Taylor"]
|
||||
let chunks = names.chunked(on: \.first)
|
||||
// [["Cassie", "Chloe"], ["Jasmine", "Jordan"], ["Taylor"]]
|
||||
```
|
||||
|
||||
#### Combining collections
|
||||
Explore more chunking methods and the remainder of the `Algorithms` package in the links below.
|
||||
|
||||
- [`chain(_:_:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Chain.md): Concatenates two collections with the same element type.
|
||||
- [`cycled()`, `cycled(times:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Cycle.md): Repeats the elements of a collection forever or a set number of times.
|
||||
- [`joined(by:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Joined.md): Concatenate sequences of sequences, using an element or sequence as a separator, or using a closure to generate each separator.
|
||||
- [`product(_:_:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Product.md): Iterates over all the pairs of two collections; equivalent to nested `for`-`in` loops.
|
||||
## Documentation
|
||||
|
||||
#### Subsetting operations
|
||||
For API documentation, see the library's official documentation in Xcode or on the Web.
|
||||
|
||||
- [`compacted()`](https://github.com/apple/swift-algorithms/blob/main/Guides/Compacted.md): Drops the `nil`s from a sequence or collection, unwrapping the remaining elements.
|
||||
- [`partitioned(by:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Partition.md): Returns the elements in a sequence or collection that do and do not match a given predicate.
|
||||
- [`randomSample(count:)`, `randomSample(count:using:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/RandomSampling.md): Randomly selects a specific number of elements from a collection.
|
||||
- [`randomStableSample(count:)`, `randomStableSample(count:using:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/RandomSampling.md): Randomly selects a specific number of elements from a collection, preserving their original relative order.
|
||||
- [`striding(by:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Stride.md): Returns every nth element of a collection.
|
||||
- [`suffix(while:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Suffix.md): Returns the suffix of a collection where all element pass a given predicate.
|
||||
- [`trimmingPrefix(while:)`, `trimmingSuffix(while)`, `trimming(while:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Trim.md): Returns a slice by trimming elements from a collection's start, end, or both. The mutating `trim...` methods trim a collection in place.
|
||||
- [`uniqued()`, `uniqued(on:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Unique.md): The unique elements of a collection, preserving their order.
|
||||
- [`minAndMax()`, `minAndMax(by:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/MinMax.md): Returns the smallest and largest elements of a sequence.
|
||||
|
||||
#### Partial sorting
|
||||
|
||||
- [`min(count:)`, `max(count:)`, `min(count:sortedBy:)`, `max(count:sortedBy:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/MinMax.md): Returns the smallest or largest elements of a collection, sorted by a predicate.
|
||||
|
||||
#### Other useful operations
|
||||
|
||||
- [`adjacentPairs()`](https://github.com/apple/swift-algorithms/blob/main/Guides/AdjacentPairs.md): Lazily iterates over tuples of adjacent elements.
|
||||
- [`chunked(by:)`, `chunked(on:)`, `chunks(ofCount:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Chunked.md): Eager and lazy operations that break a collection into chunks based on either a binary predicate or when the result of a projection changes or chunks of a given count.
|
||||
- [`firstNonNil(_:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/FirstNonNil.md): Returns the first non-`nil` result from transforming a sequence's elements.
|
||||
- [`indexed()`](https://github.com/apple/swift-algorithms/blob/main/Guides/Indexed.md): Iterate over tuples of a collection's indices and elements.
|
||||
- [`interspersed(with:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Intersperse.md): Place a value between every two elements of a sequence.
|
||||
- [`partitioningIndex(where:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Partition.md): Returns the starting index of the partition of a collection that matches a predicate.
|
||||
- [`reductions(_:)`, `reductions(_:_:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Reductions.md): Returns all the intermediate states of reducing the elements of a sequence or collection.
|
||||
- [`split(maxSplits:omittingEmptySubsequences:whereSeparator)`, `split(separator:maxSplits:omittingEmptySubsequences)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Split.md): Lazy versions of the Standard Library's eager operations that split sequences and collections into subsequences separated by the specified separator element.
|
||||
- [`windows(ofCount:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Windows.md): Breaks a collection into overlapping subsequences where elements are slices from the original collection.
|
||||
- [API documentation][docs]
|
||||
- [Swift.org announcement][announcement]
|
||||
- [API Proposals/Guides][guides]
|
||||
|
||||
## Adding Swift Algorithms as a Dependency
|
||||
|
||||
@@ -58,7 +38,7 @@ To use the `Algorithms` library in a SwiftPM project,
|
||||
add the following line to the dependencies in your `Package.swift` file:
|
||||
|
||||
```swift
|
||||
.package(url: "https://github.com/apple/swift-algorithms", from: "1.0.0"),
|
||||
.package(url: "https://github.com/apple/swift-algorithms", from: "1.2.0"),
|
||||
```
|
||||
|
||||
Include `"Algorithms"` as a dependency for your executable target:
|
||||
@@ -75,8 +55,12 @@ Finally, add `import Algorithms` to your source code.
|
||||
|
||||
The Swift Algorithms package is source stable; version numbers follow [Semantic Versioning](https://semver.org/). Source breaking changes to public API can only land in a new major version.
|
||||
|
||||
The public API of version 1.0 of the `swift-algorithms` package consists of non-underscored declarations that are marked `public` in the `Algorithms` module. Interfaces that aren't part of the public API may continue to change in any release, including patch releases.
|
||||
The public API of the `swift-algorithms` package consists of non-underscored declarations that are marked `public` in the `Algorithms` module. Interfaces that aren't part of the public API may continue to change in any release, including patch releases.
|
||||
|
||||
Future minor versions of the package may introduce changes to these rules as needed.
|
||||
|
||||
We'd like this package to quickly embrace Swift language and toolchain improvements that are relevant to its mandate. Accordingly, from time to time, we expect that new versions of this package will require clients to upgrade to a more recent Swift toolchain release. Requiring a new Swift release will only require a minor version bump.
|
||||
|
||||
[docs]: https://swiftpackageindex.com/apple/swift-algorithms/documentation/algorithms
|
||||
[announcement]: https://swift.org/blog/swift-algorithms/
|
||||
[guides]: https://github.com/apple/swift-algorithms/tree/main/Guides
|
||||
@@ -78,6 +78,10 @@ public struct CombinationsSequence<Base: Collection> {
|
||||
binomial(n: n, k: $0)
|
||||
}.reduce(0, +)
|
||||
}
|
||||
|
||||
/// The total number of combinations.
|
||||
@inlinable
|
||||
public var underestimatedCount: Int { count }
|
||||
}
|
||||
|
||||
extension CombinationsSequence: Sequence {
|
||||
|
||||
@@ -33,6 +33,7 @@ Explore more chunking methods and the remainder of the Algorithms package, group
|
||||
- <doc:Joining>
|
||||
- <doc:Extending>
|
||||
- <doc:Trimming>
|
||||
- <doc:Keying>
|
||||
- <doc:Sampling>
|
||||
- <doc:MinAndMax>
|
||||
- <doc:Selecting>
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# Keying and Grouping
|
||||
|
||||
Convert a sequence to a dictionary, providing keys to individual elements or to use as grouping values.
|
||||
|
||||
## Topics
|
||||
|
||||
### Creating a Keyed Dictionary
|
||||
|
||||
- ``Swift/Sequence/keyed(by:)``
|
||||
- ``Swift/Sequence/keyed(by:resolvingConflictsWith:)``
|
||||
|
||||
### Grouping Elements by Key
|
||||
|
||||
- ``Swift/Sequence/grouped(by:)``
|
||||
@@ -16,7 +16,7 @@ or a specific number of elements at the minimum and maximum.
|
||||
- ``Swift/Sequence/max(count:sortedBy:)``
|
||||
- ``Swift/Collection/max(count:sortedBy:)``
|
||||
|
||||
### Finding the Minimum and Maximum Elements Simulataneously
|
||||
### Finding the Minimum and Maximum Elements Simultaneously
|
||||
|
||||
- ``Swift/Sequence/minAndMax()``
|
||||
- ``Swift/Sequence/minAndMax(by:)``
|
||||
|
||||
@@ -25,3 +25,8 @@ Remove unwanted elements from the start, the end, or both ends of a collection.
|
||||
### Finding the Suffix of a Collection
|
||||
|
||||
- ``Swift/BidirectionalCollection/suffix(while:)``
|
||||
|
||||
### Finding Boundaries within a Collection
|
||||
|
||||
- ``Swift/Collection/endOfPrefix(while:)``
|
||||
- ``Swift/BidirectionalCollection/startOfSuffix(while:)``
|
||||
@@ -0,0 +1,25 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Algorithms open source project
|
||||
//
|
||||
// Copyright (c) 2021 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension Sequence {
|
||||
/// Groups up elements of `self` into a new Dictionary,
|
||||
/// whose values are Arrays of grouped elements,
|
||||
/// each keyed by the group key returned by the given closure.
|
||||
/// - Parameters:
|
||||
/// - keyForValue: A closure that returns a key for each element in
|
||||
/// `self`.
|
||||
/// - Returns: A dictionary containing grouped elements of self, keyed by
|
||||
/// the keys derived by the `keyForValue` closure.
|
||||
@inlinable
|
||||
public func grouped<GroupKey>(by keyForValue: (Element) throws -> GroupKey) rethrows -> [GroupKey: [Element]] {
|
||||
try Dictionary(grouping: self, by: keyForValue)
|
||||
}
|
||||
}
|
||||
Executable
+65
@@ -0,0 +1,65 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Algorithms open source project
|
||||
//
|
||||
// Copyright (c) 2020 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension Sequence {
|
||||
/// Creates a new Dictionary from the elements of `self`, keyed by the
|
||||
/// results returned by the given `keyForValue` closure.
|
||||
///
|
||||
/// If the key derived for a new element collides with an existing key from a previous element,
|
||||
/// the latest value will be kept.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - keyForValue: A closure that returns a key for each element in `self`.
|
||||
@inlinable
|
||||
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
|
||||
/// results returned by the given `keyForValue` closure. As the dictionary is
|
||||
/// built, the initializer calls the `resolve` closure with the current and
|
||||
/// new values for any duplicate keys. Pass a closure as `resolve` that
|
||||
/// returns the value to use in the resulting dictionary: The closure can
|
||||
/// choose between the two values, combine them to produce a new value, or
|
||||
/// even throw an error.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - keyForValue: A closure that returns a key for each element in `self`.
|
||||
/// - resolve: A closure that is called with the values for any duplicate
|
||||
/// keys that are encountered. The closure returns the desired value for
|
||||
/// the final dictionary.
|
||||
@inlinable
|
||||
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 {
|
||||
let key = try keyForValue(element)
|
||||
|
||||
if let oldValue = result.updateValue(element, forKey: key) {
|
||||
let valueToKeep = try resolve(key, oldValue, element)
|
||||
|
||||
// This causes a second look-up for the same key. The standard library can avoid that
|
||||
// by calling `mutatingFind` to get access to the bucket where the value will end up,
|
||||
// and updating in place.
|
||||
// Swift Algorithms doesn't have access to that API, so we make do.
|
||||
// When this gets merged into the standard library, we should optimize this.
|
||||
result[key] = valueToKeep
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
@@ -256,13 +256,13 @@ extension Collection {
|
||||
"""
|
||||
)
|
||||
|
||||
// Do nothing if we're prefixing nothing.
|
||||
guard count > 0 else {
|
||||
return []
|
||||
}
|
||||
|
||||
// Make sure we are within bounds.
|
||||
let prefixCount = Swift.min(count, self.count)
|
||||
|
||||
// Do nothing if we're prefixing nothing.
|
||||
guard prefixCount > 0 else {
|
||||
return []
|
||||
}
|
||||
|
||||
// If we're attempting to prefix more than 10% of the collection, it's
|
||||
// faster to sort everything.
|
||||
@@ -310,13 +310,13 @@ extension Collection {
|
||||
"""
|
||||
)
|
||||
|
||||
// Do nothing if we're suffixing nothing.
|
||||
guard count > 0 else {
|
||||
return []
|
||||
}
|
||||
|
||||
// Make sure we are within bounds.
|
||||
let suffixCount = Swift.min(count, self.count)
|
||||
|
||||
// Do nothing if we're suffixing nothing.
|
||||
guard suffixCount > 0 else {
|
||||
return []
|
||||
}
|
||||
|
||||
// If we're attempting to prefix more than 10% of the collection, it's
|
||||
// faster to sort everything.
|
||||
|
||||
@@ -210,8 +210,8 @@ extension Collection {
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
extension Sequence {
|
||||
/// Returns two arrays containing, in order, the elements of the sequence that
|
||||
/// do and don’t satisfy the given predicate.
|
||||
/// Returns two arrays containing the elements of the sequence that
|
||||
/// don’t and do satisfy the given predicate, respectively.
|
||||
///
|
||||
/// In this example, `partitioned(by:)` is used to separate the input based on
|
||||
/// whether a name is shorter than five characters:
|
||||
@@ -230,7 +230,9 @@ extension Sequence {
|
||||
///
|
||||
/// - Returns: Two arrays with all of the elements of the receiver. The
|
||||
/// first array contains all the elements that `predicate` didn’t allow, and
|
||||
/// the second array contains all the elements that `predicate` allowed.
|
||||
/// the second array contains all the elements that `predicate` allowed. The
|
||||
/// order of the elements in the arrays matches the order of the elements in
|
||||
/// the original sequence.
|
||||
///
|
||||
/// - Complexity: O(*n*), where *n* is the length of the sequence.
|
||||
@inlinable
|
||||
@@ -253,8 +255,8 @@ extension Sequence {
|
||||
}
|
||||
|
||||
extension Collection {
|
||||
/// Returns two arrays containing, in order, the elements of the collection
|
||||
/// that do and don’t satisfy the given predicate.
|
||||
/// Returns two arrays containing the elements of the collection that
|
||||
/// don’t and do satisfy the given predicate, respectively.
|
||||
///
|
||||
/// In this example, `partitioned(by:)` is used to separate the input based on
|
||||
/// whether a name is shorter than five characters.
|
||||
@@ -273,7 +275,9 @@ extension Collection {
|
||||
///
|
||||
/// - Returns: Two arrays with all of the elements of the receiver. The
|
||||
/// first array contains all the elements that `predicate` didn’t allow, and
|
||||
/// the second array contains all the elements that `predicate` allowed.
|
||||
/// the second array contains all the elements that `predicate` allowed. The
|
||||
/// order of the elements in the arrays matches the order of the elements in
|
||||
/// the original collection.
|
||||
///
|
||||
/// - Complexity: O(*n*), where *n* is the length of the collection.
|
||||
@inlinable
|
||||
|
||||
@@ -10,8 +10,35 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// For log(_:) and root(_:_:)
|
||||
#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
|
||||
#else
|
||||
@_implementationOnly
|
||||
import RealModule
|
||||
#endif
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// randomStableSample(count:)
|
||||
|
||||
@@ -512,7 +512,7 @@ extension SplitCollection: Collection {
|
||||
var subsequenceStart = i.baseRange.upperBound
|
||||
if subsequenceStart < base.endIndex {
|
||||
// If we're not already at the end of the base collection, the previous
|
||||
// susequence ended with a separator. Start searching for the next
|
||||
// subsequence ended with a separator. Start searching for the next
|
||||
// subsequence at the following element.
|
||||
subsequenceStart = base.index(after: i.baseRange.upperBound)
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ extension Collection {
|
||||
///
|
||||
/// - Complexity: O(*n*), where *n* is the length of the collection.
|
||||
@inlinable
|
||||
internal func endOfPrefix(
|
||||
public func endOfPrefix(
|
||||
while predicate: (Element) throws -> Bool
|
||||
) rethrows -> Index {
|
||||
var index = startIndex
|
||||
@@ -72,7 +72,7 @@ extension BidirectionalCollection {
|
||||
///
|
||||
/// - Complexity: O(*n*), where *n* is the length of the collection.
|
||||
@inlinable
|
||||
internal func startOfSuffix(
|
||||
public func startOfSuffix(
|
||||
while predicate: (Element) throws -> Bool
|
||||
) rethrows -> Index {
|
||||
var index = endIndex
|
||||
|
||||
@@ -32,7 +32,7 @@ extension Collection {
|
||||
while predicate: (Element) throws -> Bool
|
||||
) rethrows -> SubSequence {
|
||||
let start = try endOfPrefix(while: predicate)
|
||||
return self[start...]
|
||||
return self[start..<endIndex]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,8 +61,8 @@ extension Collection where Self: RangeReplaceableCollection {
|
||||
public mutating func trimPrefix(
|
||||
while predicate: (Element) throws -> Bool
|
||||
) rethrows {
|
||||
let end = try endOfPrefix(while: predicate)
|
||||
removeSubrange(startIndex..<end)
|
||||
let startOfResult = try endOfPrefix(while: predicate)
|
||||
removeSubrange(startIndex..<startOfResult)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ extension BidirectionalCollection {
|
||||
while predicate: (Element) throws -> Bool
|
||||
) rethrows -> SubSequence {
|
||||
let end = try startOfSuffix(while: predicate)
|
||||
return self[..<end]
|
||||
return self[startIndex..<end]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,8 +188,8 @@ extension BidirectionalCollection where Self: RangeReplaceableCollection {
|
||||
public mutating func trimSuffix(
|
||||
while predicate: (Element) throws -> Bool
|
||||
) rethrows {
|
||||
let start = try startOfSuffix(while: predicate)
|
||||
removeSubrange(start..<endIndex)
|
||||
let endOfResult = try startOfSuffix(while: predicate)
|
||||
removeSubrange(endOfResult..<endIndex)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,57 +15,63 @@ import Algorithms
|
||||
final class CombinationsTests: XCTestCase {
|
||||
func testCount() {
|
||||
let c = "ABCD"
|
||||
|
||||
let c0 = c.combinations(ofCount: 0).count
|
||||
XCTAssertEqual(c0, 1)
|
||||
|
||||
let c1 = c.combinations(ofCount: 1).count
|
||||
XCTAssertEqual(c1, 4)
|
||||
|
||||
let c2 = c.combinations(ofCount: 2).count
|
||||
XCTAssertEqual(c2, 6)
|
||||
|
||||
let c3 = c.combinations(ofCount: 3).count
|
||||
XCTAssertEqual(c3, 4)
|
||||
|
||||
let c4 = c.combinations(ofCount: 4).count
|
||||
XCTAssertEqual(c4, 1)
|
||||
|
||||
let c5 = c.combinations(ofCount: 0...0).count
|
||||
XCTAssertEqual(c5, 1)
|
||||
|
||||
let c6 = c.combinations(ofCount: 1...1).count
|
||||
XCTAssertEqual(c6, 4)
|
||||
|
||||
let c7 = c.combinations(ofCount: 1...2).count
|
||||
XCTAssertEqual(c7, 10)
|
||||
|
||||
let c8 = c.combinations(ofCount: 1...3).count
|
||||
XCTAssertEqual(c8, 14)
|
||||
|
||||
let c9 = c.combinations(ofCount: 2...4).count
|
||||
XCTAssertEqual(c9, 11)
|
||||
|
||||
/// XCTAsserts that `x`'s `count` and `underestimatedCount` are both `l` at
|
||||
/// the given `file` and `line`.
|
||||
func check(
|
||||
_ x: CombinationsSequence<String>, countsAre l: Int,
|
||||
file: StaticString, line: UInt)
|
||||
{
|
||||
XCTAssertEqual(x.count, l, "unexpected count", file: file, line: line)
|
||||
XCTAssertEqual(
|
||||
x.underestimatedCount, l, "unexpected underestimatedCount",
|
||||
file: file, line: line)
|
||||
}
|
||||
|
||||
/// XCTAsserts that the `count` and `underestimatedCount` of
|
||||
/// `c.combinations(ofCount: l)` are both `n` at the given `file` and
|
||||
/// `line`.
|
||||
func check(
|
||||
cHas n: Int,
|
||||
combinationsOfLength l: Int,
|
||||
file: StaticString = #filePath, line: UInt = #line)
|
||||
{
|
||||
check(c.combinations(ofCount: l), countsAre: n, file: file, line: line)
|
||||
}
|
||||
|
||||
/// XCTAsserts that the `count` and `underestimatedCount` of
|
||||
/// `c.combinations(ofCount: l)` are both `n` at the given `file` and
|
||||
/// `line`.
|
||||
func check<R: RangeExpression>(
|
||||
cHas n: Int,
|
||||
combinationsOfLengths l: R,
|
||||
file: StaticString = #filePath, line: UInt = #line) where R.Bound == Int
|
||||
{
|
||||
check(c.combinations(ofCount: l), countsAre: n, file: file, line: line)
|
||||
}
|
||||
|
||||
check(cHas: 1, combinationsOfLength: 0)
|
||||
check(cHas: 4, combinationsOfLength: 1)
|
||||
check(cHas: 6, combinationsOfLength: 2)
|
||||
check(cHas: 1, combinationsOfLength: 4)
|
||||
|
||||
check(cHas: 1, combinationsOfLengths: 0...0)
|
||||
check(cHas: 4, combinationsOfLengths: 1...1)
|
||||
check(cHas: 10, combinationsOfLengths: 1...2)
|
||||
check(cHas: 14, combinationsOfLengths: 1...3)
|
||||
check(cHas: 11, combinationsOfLengths: 2...4)
|
||||
|
||||
// `k` greater than element count results in same number of combinations
|
||||
check(cHas: 5, combinationsOfLengths: 3...10)
|
||||
|
||||
// `k` greater than element count results in same number of combinations
|
||||
let c10 = c.combinations(ofCount: 3...10).count
|
||||
XCTAssertEqual(c10, 5)
|
||||
|
||||
// `k` greater than element count results in same number of combinations
|
||||
let c11 = c.combinations(ofCount: 4...10).count
|
||||
XCTAssertEqual(c11, 1)
|
||||
check(cHas: 1, combinationsOfLengths: 4...10)
|
||||
|
||||
// `k` entirely greater than element count results in no combinations
|
||||
let c12 = c.combinations(ofCount: 5...10).count
|
||||
XCTAssertEqual(c12, 0)
|
||||
check(cHas: 0, combinationsOfLengths: 5...10)
|
||||
|
||||
let c13 = c.combinations(ofCount: 0...).count
|
||||
XCTAssertEqual(c13, 16)
|
||||
|
||||
let c14 = c.combinations(ofCount: ...3).count
|
||||
XCTAssertEqual(c14, 15)
|
||||
|
||||
let c15 = c.combinations(ofCount: 0...).count
|
||||
XCTAssertEqual(c15, 16)
|
||||
check(cHas: 16, combinationsOfLengths: 0...)
|
||||
check(cHas: 15, combinationsOfLengths: ...3)
|
||||
}
|
||||
|
||||
func testCombinations() {
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Algorithms open source project
|
||||
//
|
||||
// Copyright (c) 2020 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import XCTest
|
||||
import Algorithms
|
||||
|
||||
final class GroupedTests: XCTestCase {
|
||||
private final class SampleError: Error {}
|
||||
|
||||
// Based on https://github.com/apple/swift/blob/4d1d8a9de5ebc132a17aee9fc267461facf89bf8/validation-test/stdlib/Dictionary.swift#L1974-L1988
|
||||
|
||||
func testGroupedBy() {
|
||||
let r = 0..<10
|
||||
|
||||
let d1 = r.grouped(by: { $0 % 3 })
|
||||
XCTAssertEqual(3, d1.count)
|
||||
XCTAssertEqual(d1[0]!, [0, 3, 6, 9])
|
||||
XCTAssertEqual(d1[1]!, [1, 4, 7])
|
||||
XCTAssertEqual(d1[2]!, [2, 5, 8])
|
||||
|
||||
let d2 = r.grouped(by: { $0 })
|
||||
XCTAssertEqual(10, d2.count)
|
||||
|
||||
let d3 = (0..<0).grouped(by: { $0 })
|
||||
XCTAssertEqual(0, d3.count)
|
||||
}
|
||||
|
||||
func testThrowingFromKeyFunction() {
|
||||
let input = ["Apple", "Banana", "Cherry"]
|
||||
let error = SampleError()
|
||||
|
||||
XCTAssertThrowsError(
|
||||
try input.grouped(by: { (_: String) -> Character in throw error })
|
||||
) { thrownError in
|
||||
XCTAssertIdentical(error, thrownError as? SampleError)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the Swift Algorithms open source project
|
||||
//
|
||||
// Copyright (c) 2020 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import XCTest
|
||||
import Algorithms
|
||||
|
||||
final class KeyedTests: XCTestCase {
|
||||
private final class SampleError: Error {}
|
||||
|
||||
func testUniqueKeys() {
|
||||
let d = ["Apple", "Banana", "Cherry"].keyed(by: { $0.first! })
|
||||
XCTAssertEqual(d.count, 3)
|
||||
XCTAssertEqual(d["A"]!, "Apple")
|
||||
XCTAssertEqual(d["B"]!, "Banana")
|
||||
XCTAssertEqual(d["C"]!, "Cherry")
|
||||
XCTAssertNil(d["D"])
|
||||
}
|
||||
|
||||
func testEmpty() {
|
||||
let d = EmptyCollection<String>().keyed(by: { $0.first! })
|
||||
XCTAssertEqual(d.count, 0)
|
||||
}
|
||||
|
||||
func testNonUniqueKeys() throws {
|
||||
let d = ["Apple", "Avocado", "Banana", "Cherry"].keyed(by: { $0.first! })
|
||||
XCTAssertEqual(d.count, 3)
|
||||
XCTAssertEqual(d["A"]!, "Avocado", "On a key-collision, keyed(by:) should take the latest value.")
|
||||
XCTAssertEqual(d["B"]!, "Banana")
|
||||
XCTAssertEqual(d["C"]!, "Cherry")
|
||||
}
|
||||
|
||||
func testNonUniqueKeysWithMergeFunction() {
|
||||
var resolveCallHistory = [(key: Character, current: String, new: String)]()
|
||||
let expectedCallHistory = [
|
||||
(key: "A", current: "Apple", new: "Avocado"),
|
||||
(key: "C", current: "Cherry", new: "Coconut"),
|
||||
]
|
||||
|
||||
let d = ["Apple", "Avocado", "Banana", "Cherry", "Coconut"].keyed(
|
||||
by: { $0.first! },
|
||||
resolvingConflictsWith: { key, older, newer in
|
||||
resolveCallHistory.append((key, older, newer))
|
||||
return "\(older)-\(newer)"
|
||||
}
|
||||
)
|
||||
|
||||
XCTAssertEqual(d.count, 3)
|
||||
XCTAssertEqual(d["A"]!, "Apple-Avocado")
|
||||
XCTAssertEqual(d["B"]!, "Banana")
|
||||
XCTAssertEqual(d["C"]!, "Cherry-Coconut")
|
||||
XCTAssertNil(d["D"])
|
||||
|
||||
XCTAssertEqual(
|
||||
resolveCallHistory.map(String.init(describing:)), // quick/dirty workaround: tuples aren't Equatable
|
||||
expectedCallHistory.map(String.init(describing:))
|
||||
)
|
||||
}
|
||||
|
||||
func testThrowingFromKeyFunction() {
|
||||
let input = ["Apple", "Banana", "Cherry"]
|
||||
let error = SampleError()
|
||||
|
||||
XCTAssertThrowsError(
|
||||
try input.keyed(by: { (_: String) -> Character in throw error })
|
||||
) { thrownError in
|
||||
XCTAssertIdentical(error, thrownError as? SampleError)
|
||||
}
|
||||
}
|
||||
|
||||
func testThrowingFromCombineFunction() {
|
||||
let input = ["Apple", "Avocado", "Banana", "Cherry"]
|
||||
let error = SampleError()
|
||||
|
||||
XCTAssertThrowsError(
|
||||
try input.keyed(by: { $0.first! }, resolvingConflictsWith: { _, _, _ in throw error })
|
||||
) { thrownError in
|
||||
XCTAssertIdentical(error, thrownError as? SampleError)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import XCTest
|
||||
@testable import Algorithms
|
||||
import Algorithms
|
||||
|
||||
final class SuffixTests: XCTestCase {
|
||||
func testSuffix() {
|
||||
|
||||
@@ -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()
|
||||
@@ -216,7 +216,7 @@ extension IndexValidator {
|
||||
/// - expectedCount:
|
||||
///
|
||||
/// - Complexity: O(*n*^3) where *n* is the length of the collection if the
|
||||
/// collection conforms to `RandomAccesCollection`, otherwise O(*n*^4).
|
||||
/// collection conforms to `RandomAccessCollection`, otherwise O(*n*^4).
|
||||
func validate(
|
||||
_ collection: C,
|
||||
expectedCount: Int? = nil,
|
||||
|
||||
@@ -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
|
||||
@@ -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>
|
||||
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
@@ -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.)
|
||||
@@ -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
|
||||
Reference in new issue
Block a user