Skip to content

Commit 5d2b708

Browse files
committed
Continue renaming function
1 parent 2c089e3 commit 5d2b708

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This project follows semantic versioning.
1313
- Bidirectional collections have a new `ends(with:)` method that matches
1414
the behavior of the standard library's `starts(with:)` method. ([#224])
1515
- Sequences that are already sorted can use the `countSortedDuplicates` and
16-
`withoutSortedDuplicates` methods, with eager and lazy versions.
16+
`deduplicateSorted` methods, with eager and lazy versions.
1717
The former returns each unique value paired with the count of
1818
that value's occurances.
1919
The latter returns each unique value,

Guides/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ These guides describe the design and intention behind the APIs included in the `
2525
#### Subsetting operations
2626

2727
- [`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.
28+
- [`deduplicateSorted()`, `deduplicateSorted(by:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/SortedDuplicates.md): Given an already-sorted sequence and the sorting predicate, reduce all runs of a unique value to a single element each. Has eager and lazy variants.
2829
- [`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.
2930
- [`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.
3031
- [`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.
3132
- [`striding(by:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Stride.md): Returns every nth element of a collection.
3233
- [`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.
3334
- [`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.
3435
- [`uniqued()`, `uniqued(on:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/Unique.md): The unique elements of a collection, preserving their order.
35-
- [`withoutSortedDuplicates()`, `withoutSortedDuplicates(by:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/SortedDuplicates.md): Given an already-sorted sequence and the sorting predicate, reduce all runs of a unique value to a single element each. Has eager and lazy variants.
3636
- [`minAndMax()`, `minAndMax(by:)`](https://github.com/apple/swift-algorithms/blob/main/Guides/MinMax.md): Returns the smallest and largest elements of a sequence.
3737

3838
#### Partial sorting

Guides/SortedDuplicates.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,23 @@ extension Sequence {
2121
by areInIncreasingOrder: (Element, Element) throws -> Bool
2222
) rethrows -> [(value: Element, count: Int)]
2323

24-
public func withoutSortedDuplicates(
24+
public func deduplicateSorted(
2525
by areInIncreasingOrder: (Element, Element) throws -> Bool
2626
) rethrows -> [Element]
2727
}
2828

2929
extension Sequence where Self.Element : Comparable {
3030
public func countSortedDuplicates() -> [(value: Element, count: Int)]
3131

32-
public func withoutSortedDuplicates() -> [Element]
32+
public func deduplicateSorted() -> [Element]
3333
}
3434

3535
extension LazySequenceProtocol {
3636
public func countSortedDuplicates(
3737
by areInIncreasingOrder: @escaping (Element, Element) -> Bool
3838
) -> LazyCountDuplicatesSequence<Elements>
3939

40-
public func withoutSortedDuplicates(
40+
public func deduplicateSorted(
4141
by areInIncreasingOrder: @escaping (Element, Element) -> Bool
4242
) -> some (Sequence<Element> & LazySequenceProtocol)
4343
}
@@ -46,7 +46,7 @@ extension LazySequenceProtocol where Self.Element : Comparable {
4646
public func countSortedDuplicates()
4747
-> LazyCountDuplicatesSequence<Elements>
4848

49-
public func withoutSortedDuplicates()
49+
public func deduplicateSorted()
5050
-> some (Sequence<Element> & LazySequenceProtocol)
5151
}
5252

Sources/Algorithms/Documentation.docc/Filtering.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ let withNoNils = array.compacted()
2121
// Array(withNoNils) == [10, 30, 2, 3, 5]
2222
```
2323

24-
The `withoutSortedDuplicates()` methods remove consecutive elements of the same equivalence class from an already sorted sequence, turning a possibly non-decreasing sequence to a strictly-increasing one. The sorting predicate can be supplied.
24+
The `deduplicateSorted()` methods remove consecutive elements of the same equivalence class from an already sorted sequence, turning a possibly non-decreasing sequence to a strictly-increasing one. The sorting predicate can be supplied.
2525

2626
```swift
2727
let numbers = [0, 1, 2, 2, 2, 3, 5, 6, 6, 9, 10, 10]
28-
let deduplicated = numbers.withoutSortedDuplicates()
28+
let deduplicated = numbers.deduplicateSorted()
2929
// Array(deduplicated) == [0, 1, 2, 3, 5, 6, 9, 10]
3030
```
3131

@@ -44,10 +44,10 @@ let deduplicated = numbers.withoutSortedDuplicates()
4444

4545
### Removing Duplicates from a Sorted Sequence
4646

47-
- ``Swift/Sequence/withoutSortedDuplicates(by:)``
48-
- ``Swift/Sequence/withoutSortedDuplicates()``
49-
- ``Swift/LazySequenceProtocol/withoutSortedDuplicates(by:)``
50-
- ``Swift/LazySequenceProtocol/withoutSortedDuplicates()``
47+
- ``Swift/Sequence/deduplicateSorted(by:)``
48+
- ``Swift/Sequence/deduplicateSorted()``
49+
- ``Swift/LazySequenceProtocol/deduplicateSorted(by:)``
50+
- ``Swift/LazySequenceProtocol/deduplicateSorted()``
5151

5252
### Supporting Types
5353

Tests/SwiftAlgorithmsTests/SortedDuplicatesTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ final class SortedDuplicatesTests: XCTestCase {
8383
/// Test the example code from the Overview.
8484
func testOverviewExample() {
8585
let numbers = [0, 1, 2, 2, 2, 3, 5, 6, 6, 9, 10, 10]
86-
let deduplicated = numbers.withoutSortedDuplicates()
86+
let deduplicated = numbers.deduplicateSorted()
8787
// Array(deduplicated) == [0, 1, 2, 3, 5, 6, 9, 10]
8888

8989
expectEqualSequences(deduplicated, [0, 1, 2, 3, 5, 6, 9, 10])

0 commit comments

Comments
 (0)