@@ -303,7 +303,7 @@ extension Collection {
303
303
/// A collection that presents the elements of its base collection in
304
304
/// `SubSequence` chunks of any given count.
305
305
///
306
- /// A `ChunksOfCountCollection` is a lazy view on the base Collection, but it
306
+ /// A `ChunksOfCountCollection` is a lazy view on the base ` Collection` , but it
307
307
/// does not implicitly confer laziness on algorithms applied to its result. In
308
308
/// other words, for ordinary collections `c`:
309
309
///
@@ -486,11 +486,11 @@ extension ChunksOfCountCollection {
486
486
_ i: Index , _ distance: Int
487
487
) -> Int {
488
488
if i == endIndex {
489
- let remainder = base. count% chunkCount
489
+ let remainder = base. count % chunkCount
490
490
// We have to take it into account when calculating offsets.
491
491
if remainder != 0 {
492
- // Distance "minus" one(at this point distance is negative) because we
493
- // need to adjust for the last position that have a variadic(remainder)
492
+ // Distance "minus" one (at this point distance is negative) because we
493
+ // need to adjust for the last position that have a variadic (remainder)
494
494
// number of elements.
495
495
return ( ( distance + 1 ) * chunkCount) - remainder
496
496
}
@@ -512,7 +512,7 @@ extension ChunksOfCountCollection {
512
512
)
513
513
}
514
514
515
- // Helper to compute index(offsetBy:) index.
515
+ // Helper to compute ` index(offsetBy:)` index.
516
516
@inlinable
517
517
internal func makeOffsetIndex(
518
518
from i: Index , baseBound: Base . Index , distance: Int , baseDistance: Int ,
@@ -525,13 +525,13 @@ extension ChunksOfCountCollection {
525
525
526
526
if let limit = limit {
527
527
if baseIdx == nil {
528
- // If we past the bounds while advancing forward and the limit is the
529
- // `endIndex`, since the computation on base don't take into account the
530
- // remainder, we have to make sure that passing the bound was because of
531
- // the distance not just because of a remainder. Special casing is less
532
- // expensive than always use count(which could be O(n) for non-random
533
- // access collection base) to compute the base distance taking remainder
534
- // into account.
528
+ // If we passed the bounds while advancing forward, and the limit is the
529
+ // `endIndex`, since the computation on ` base` don't take into account
530
+ // the remainder, we have to make sure that passing the bound was
531
+ // because of the distance not just because of a remainder. Special
532
+ // casing is less expensive than always using ` count` (which could be
533
+ // O(n) for non-random access collection base) to compute the base
534
+ // distance taking remainder into account.
535
535
if baseDistance > 0 && limit == endIndex {
536
536
if self . distance ( from: i, to: limit) < distance {
537
537
return nil
@@ -561,7 +561,7 @@ extension Collection {
561
561
/// Returns a `ChunksOfCountCollection<Self>` view presenting the elements in
562
562
/// chunks with count of the given count parameter.
563
563
///
564
- /// - Parameter count: The size of the chunks. If the count parameter is
564
+ /// - Parameter count: The size of the chunks. If the ` count` parameter is
565
565
/// evenly divided by the count of the base `Collection` all the chunks will
566
566
/// have the count equals to size. Otherwise, the last chunk will contain
567
567
/// the remaining elements.
0 commit comments