Skip to content

Commit 518c31c

Browse files
committed
Refine top-level curation
1 parent 5c0958b commit 518c31c

15 files changed

+85
-102
lines changed
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
# ``Algorithms``
22

3-
**Swift Algorithms** is an open-source package of sequence and collection algorithms, along with their related types.
3+
**Swift Algorithms** is an open-source package of sequence and collection algorithms,
4+
along with their related types.
45

56
## Overview
67

7-
This library provides a bunch of new `Sequence` and `Collection` methods, plus some global functions.
8+
This library adds a variety of extended operations to the Swift standard library's
9+
`Sequence` and `Collection` protocols, via extension methods and global functions.
810

911
## Topics
1012

1113
- <doc:CombinationsPermutations>
12-
- <doc:Slices>
13-
- <doc:Chunked>
14+
- <doc:SlicingSplitting>
15+
- <doc:Chunking>
1416
- <doc:Joining>
1517
- <doc:Extending>
16-
- <doc:Trim>
18+
- <doc:Trimming>
1719
- <doc:Sampling>
18-
- <doc:Selection>
20+
- <doc:MinAndMax>
21+
- <doc:Selecting>
1922
- <doc:Filtering>
2023
- <doc:Reductions>
2124
- <doc:Partitioning>

Sources/Algorithms/Documentation.docc/Chunked.md renamed to Sources/Algorithms/Documentation.docc/Chunking.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Chunked
1+
# Chunking
22

3-
Break collections into consecutive chunks by length or based on closure-based logic.
3+
Break collections into consecutive chunks by length, count, or based on closure-based logic.
44

55
## Overview
66

Sources/Algorithms/Documentation.docc/CombinationsPermutations.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
# Combinations and Permutations
22

3-
You can call the `combinations(ofCount:)`, `permutations(ofCount:)`, and `uniquePermutations(ofCount:)` methods on any collection, or combine two collections using the `product(_:_:)` function.
4-
5-
## Overview
6-
7-
...
3+
Find the combinations and permutations of any collection's elements,
4+
or the product of two different collections.
85

96
## Topics
107

Sources/Algorithms/Documentation.docc/DeprecatedScan.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# DeprecatedScan
22

3-
<!--@START_MENU_TOKEN@-->Summary<!--@END_MENU_TOKEN@-->
3+
These methods are deprecated, use the `reductions` family of methods instead.
44

55
## Overview
66

7-
<!--@START_MENU_TOKEN@-->Text<!--@END_MENU_TOKEN@-->
8-
97
## Topics
108

119
- ``Swift/Sequence/scan(_:)``

Sources/Algorithms/Documentation.docc/Extending.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
1-
# Extending a Collection
1+
# Extending
22

3-
...
3+
Chain two collections end-to-end,
4+
or repeat a collection forever or a specific number of times.
45

5-
## Overview
6+
## Topics
67

7-
...
8+
### Chaining Two Collections
89

9-
## Topics
10+
- ``chain(_:_:)``
1011

1112
### Cycling a Collection
1213

1314
- ``Swift/Collection/cycled()``
1415
- ``Swift/Collection/cycled(times:)``
1516

16-
### Chaining Two Collections
17-
18-
- ``chain(_:_:)``
19-
2017
### Supporting Types
2118

2219
- ``Chain2Sequence``

Sources/Algorithms/Documentation.docc/Filtering.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Filtering
22

3-
<!--@START_MENU_TOKEN@-->Summary<!--@END_MENU_TOKEN@-->
3+
Remove duplicated elements or strip the `nil` values from a sequence or collection.
44

55
## Overview
66

Sources/Algorithms/Documentation.docc/Joining.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# Joining
22

3-
...
4-
5-
## Overview
6-
7-
...
3+
Join the parts of a collection of collections,
4+
providing a connecting element or collection,
5+
or a closure that produces the connector.
86

97
## Topics
108

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Finding the Minimum and Maximum
2+
3+
Find the minimum and maximum elements simultaneously,
4+
or a specific number of elements at the minimum and maximum.
5+
6+
## Topics
7+
8+
### Finding Minimum or Maximum Elements
9+
10+
- ``Swift/Sequence/min(count:)``
11+
- ``Swift/Collection/min(count:)``
12+
- ``Swift/Sequence/min(count:sortedBy:)``
13+
- ``Swift/Collection/min(count:sortedBy:)``
14+
- ``Swift/Sequence/max(count:)``
15+
- ``Swift/Collection/max(count:)``
16+
- ``Swift/Sequence/max(count:sortedBy:)``
17+
- ``Swift/Collection/max(count:sortedBy:)``
18+
19+
### Finding the Minimum and Maximum Elements Simulataneously
20+
21+
- ``Swift/Sequence/minAndMax()``
22+
- ``Swift/Sequence/minAndMax(by:)``
23+

Sources/Algorithms/Documentation.docc/Partitioning.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
# Partitioning and Rotating
22

3-
...
4-
5-
## Overview
6-
7-
...
3+
Partition a collection according to a unary predicate,
4+
rotate a collection around a particular index,
5+
or find the index where a collection is already partitioned.
86

97
## Topics
108

11-
### Partition
12-
13-
- ``Swift/MutableCollection/partition(subrange:by:)-5vdh7``
14-
- ``Swift/MutableCollection/partition(subrange:by:)-4gpqz``
15-
169
### Stable Partition
1710

1811
- ``Swift/MutableCollection/stablePartition(by:)``
1912
- ``Swift/MutableCollection/stablePartition(subrange:by:)``
2013
- ``Swift/Sequence/partitioned(by:)``
2114
- ``Swift/Collection/partitioned(by:)``
2215

16+
### Partition of Subranges
17+
18+
- ``Swift/MutableCollection/partition(subrange:by:)-5vdh7``
19+
- ``Swift/MutableCollection/partition(subrange:by:)-4gpqz``
20+
2321
### Finding a Partition Index
2422

2523
- ``Swift/Collection/partitioningIndex(where:)``

Sources/Algorithms/Documentation.docc/Reductions.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# Reductions
22

3-
<!--@START_MENU_TOKEN@-->Summary<!--@END_MENU_TOKEN@-->
4-
5-
## Overview
6-
7-
<!--@START_MENU_TOKEN@-->Text<!--@END_MENU_TOKEN@-->
3+
Find the incremental values of a sequence "reduce" operation.
84

95
## Topics
106

Sources/Algorithms/Documentation.docc/Sampling.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
Choose a specified number of random elements from a sequence or collection.
44

5-
## Overview
6-
7-
...
8-
95
## Topics
106

117
### Random Sampling
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Selecting Elements
2+
3+
Select elements at a particular interval, the first mapped value,
4+
or iterate of elements with their indices.
5+
6+
## Topics
7+
8+
### Selecting Elements at an Interval
9+
10+
- ``Swift/Sequence/striding(by:)``
11+
- ``Swift/Collection/striding(by:)``
12+
13+
### Conditionally Finding the First Mapped Value
14+
15+
- ``Swift/Sequence/firstNonNil(_:)``
16+
17+
### Iterating Over Elements with Their Indices
18+
19+
- ``Swift/Collection/indexed()``
20+
21+
### Supporting Types
22+
23+
- ``IndexedCollection``
24+
- ``StridingSequence``
25+
- ``StridingCollection``

Sources/Algorithms/Documentation.docc/Selection.md

Lines changed: 0 additions & 43 deletions
This file was deleted.

Sources/Algorithms/Documentation.docc/Slices.md renamed to Sources/Algorithms/Documentation.docc/SlicingSplitting.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
Iterate over tuple pairs of adjacent elements, overlapping windows of a specified size, or lazily-calculated splits.
44

5-
## Overview
6-
7-
...
8-
95
## Topics
106

117
### Adjacent Pairs

Sources/Algorithms/Documentation.docc/Trim.md renamed to Sources/Algorithms/Documentation.docc/Trimming.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
# Trimming a Collection
1+
# Trimming
22

33
Remove unwanted elements from the start, the end, or both ends of a collection.
44

5-
## Overview
6-
7-
...
8-
95
## Topics
106

117
### Trimming Both Ends of a Collection
@@ -26,3 +22,6 @@ Remove unwanted elements from the start, the end, or both ends of a collection.
2622
- ``Swift/BidirectionalCollection/trimSuffix(while:)-33ubj``
2723
- ``Swift/BidirectionalCollection/trimSuffix(while:)-3o6x9``
2824

25+
### Finding the Suffix of a Collection
26+
27+
- ``Swift/BidirectionalCollection/suffix(while:)``

0 commit comments

Comments
 (0)