Skip to content

Commit 8bf863f

Browse files
committed
Improve comments
1 parent 268d7cb commit 8bf863f

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

stdlib/public/core/Reverse.swift

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ extension MutableCollection where Self: BidirectionalCollection {
3838
/// A collection that presents the elements of its base collection
3939
/// in reverse order.
4040
///
41-
/// - See also: `ReversedCollection` below.
41+
/// - See also: `ReversedCollection`
4242
public protocol ReversedCollectionProtocol: BidirectionalCollection {
43-
/// A `Collection` that can contain the same elements as this one,
43+
/// A `Collection` that contains the same elements as this one,
4444
/// just in reverse order.
4545
associatedtype Elements: Collection where Elements.Iterator.Element == Iterator.Element
4646
var elements: Elements { get }
@@ -60,8 +60,6 @@ public protocol ReversedCollectionProtocol: BidirectionalCollection {
6060
/// * `c.reversed()` does not create new storage
6161
/// * `c.reversed().map(f)` maps eagerly and returns a new array
6262
/// * `c.lazy.reversed().map(f)` maps lazily and returns a `LazyMapCollection`
63-
///
64-
/// - See also: `ReversedRandomAccessCollection`
6563
@_fixed_layout
6664
public struct ReversedCollection<Base: BidirectionalCollection> {
6765
public let _base: Base
@@ -274,8 +272,10 @@ extension ReversedCollection: BidirectionalCollection {
274272
extension ReversedCollection: RandomAccessCollection where Base: RandomAccessCollection { }
275273

276274
extension ReversedCollection {
277-
/// This is optimization to return original collection of doubly reversed collection
278-
/// For example [1,2].reversed().reversed() => [1,2]
275+
// This is optimization to return original collection of doubly reversed collection
276+
// For example [1,2].reversed().reversed() => [1,2]
277+
278+
/// Returns the elements of the original collection (reversal of reversal)
279279
public func reversed() -> Base {
280280
return _base
281281
}
@@ -314,8 +314,11 @@ extension BidirectionalCollection {
314314
}
315315

316316
extension LazyCollection where Base: ReversedCollectionProtocol {
317-
/// This is optimization to return original collection of doubly reversed lazy collection
318-
/// For example [1,2].lazy.reversed().reversed() => [1,2].lazy
317+
// This is optimization to return original collection of doubly reversed lazy collection
318+
// For example [1,2].lazy.reversed().reversed() => [1,2].lazy
319+
320+
321+
/// Returns the elements of the original lazy collection (reversal of reversal)
319322
public func reversed() -> LazyCollection<Elements.Elements> {
320323
return elements.elements.lazy
321324
}

0 commit comments

Comments
 (0)