small documentation tweek collection -> sequence

This commit is contained in:
Oliver Atkinson committed 2020-11-06 10:31:40 +00:00
1 parent 28bbed8776
commit 377bb72f0a
2 files changed
+5 -5

No files matched your search

+2 -2
View File
@@ -3,7 +3,7 @@
[[Source](https://github.com/apple/swift-algorithms/blob/main/Sources/Algorithms/Stride.swift) |
[Tests](https://github.com/apple/swift-algorithms/blob/main/Tests/SwiftAlgorithmsTests/StrideTests.swift)]
A type that steps over a collection’s elements by the specified amount.
A type that steps over sequence elements by the specified amount.
This is available through the `striding(by:)` method on any `Sequence`.
@@ -11,7 +11,7 @@ This is available through the `striding(by:)` method on any `Sequence`.
(0...10).striding(by: 2) // == [0, 2, 4, 6, 8, 10]
```
If the stride is larger than the collection count, the resulting wrapper only contains the
If the stride is larger than the count, the resulting wrapper only contains the
first element.
The stride amount must be a positive value.
+3 -3
View File
@@ -14,7 +14,7 @@
//===----------------------------------------------------------------------===//
extension Sequence {
/// Returns a collection stepping through the elements every `step` starting
/// Returns a sequence stepping through the elements every `step` starting
/// at the first value. Any remainders of the stride will be trimmed.
///
/// (0...10).striding(by: 2) // == [0, 2, 4, 6, 8, 10]
@@ -25,8 +25,8 @@ extension Sequence {
/// O(_k_), where _k_ is the striding `step`.
///
/// - Parameter step: The amount to step with each iteration.
/// - Returns: Returns a collection stepping through the elements by the
/// specified amount.
/// - Returns: Returns a sequence or collection for stepping through the
/// elements by the specified amount.
public func striding(by step: Int) -> Stride<Self> {
Stride(base: self, stride: step)
}