diff --git a/Guides/Stride.md b/Guides/Stride.md index 0c46ecc..a309f25 100644 --- a/Guides/Stride.md +++ b/Guides/Stride.md @@ -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. diff --git a/Sources/Algorithms/Stride.swift b/Sources/Algorithms/Stride.swift index ee8a5ab..19ca012 100644 --- a/Sources/Algorithms/Stride.swift +++ b/Sources/Algorithms/Stride.swift @@ -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 { Stride(base: self, stride: step) }