Skip to content

Commit ab5846c

Browse files
committed
Shorten parameter name in doc example.
1 parent 3be8321 commit ab5846c

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

stdlib/public/core/LazySequence.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@
4545
/// /// (1..<6).scan(0, +) // [0, 1, 3, 6, 10, 15]
4646
/// ///
4747
/// /// - Complexity: O(n)
48-
/// func scan<ResultElement>(
49-
/// _ initial: ResultElement,
50-
/// _ nextPartialResult: (ResultElement, Element) -> ResultElement
51-
/// ) -> [ResultElement] {
48+
/// func scan<Result>(
49+
/// _ initial: Result,
50+
/// _ nextPartialResult: (Result, Element) -> Result
51+
/// ) -> [Result] {
5252
/// var result = [initial]
5353
/// for x in self {
5454
/// result.append(nextPartialResult(result.last!, x))
@@ -60,21 +60,21 @@
6060
/// You can build a sequence type that lazily computes the elements in the
6161
/// result of a scan:
6262
///
63-
/// struct LazyScanSequence<Base: Sequence, ResultElement>
63+
/// struct LazyScanSequence<Base: Sequence, Result>
6464
/// : LazySequenceProtocol
6565
/// {
66-
/// let initial: ResultElement
66+
/// let initial: Result
6767
/// let base: Base
6868
/// let nextPartialResult:
69-
/// (ResultElement, Base.Element) -> ResultElement
69+
/// (Result, Base.Element) -> Result
7070
///
7171
/// struct Iterator: IteratorProtocol {
7272
/// var base: Base.Iterator
73-
/// var nextElement: ResultElement?
73+
/// var nextElement: Result?
7474
/// let nextPartialResult:
75-
/// (ResultElement, Base.Element) -> ResultElement
75+
/// (Result, Base.Element) -> Result
7676
///
77-
/// mutating func next() -> ResultElement? {
77+
/// mutating func next() -> Result? {
7878
/// return nextElement.map { result in
7979
/// nextElement = base.next().map {
8080
/// nextPartialResult(result, $0)
@@ -87,19 +87,19 @@
8787
/// func makeIterator() -> Iterator {
8888
/// return Iterator(
8989
/// base: base.makeIterator(),
90-
/// nextElement: initial as ResultElement?,
90+
/// nextElement: initial as Result?,
9191
/// nextPartialResult: nextPartialResult)
9292
/// }
9393
/// }
9494
///
9595
/// Finally, you can give all lazy sequences a lazy `scan(_:_:)` method:
9696
///
9797
/// extension LazySequenceProtocol {
98-
/// func scan<ResultElement>(
99-
/// _ initial: ResultElement,
100-
/// _ nextPartialResult: @escaping (ResultElement, Element) -> ResultElement
101-
/// ) -> LazyScanSequence<Self, ResultElement> {
102-
/// return LazyScanSequence<Self, ResultElement>(
98+
/// func scan<Result>(
99+
/// _ initial: Result,
100+
/// _ nextPartialResult: @escaping (Result, Element) -> Result
101+
/// ) -> LazyScanSequence<Self, Result> {
102+
/// return LazyScanSequence(
103103
/// initial: initial, base: self, nextPartialResult: nextPartialResult)
104104
/// }
105105
/// }

0 commit comments

Comments
 (0)