Skip to content

Commit ae445cd

Browse files
committed
Mention conditional conformance to LazySequenceProtocol in the guides
1 parent f1c4af9 commit ae445cd

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

Guides/Chain.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ extension Sequence {
2929
public func chained<S: Sequence>(with other: S) -> Concatenation<Self, S>
3030
where Element == S.Element
3131
}
32-
3332
```
3433

35-
The resulting `Chain` type is a sequence, with conditional conformance to the
36-
`Collection`, `BidirectionalCollection`, and `RandomAccessCollection` when both
37-
the first and second arguments conform.
34+
The resulting `Chain` type is a sequence, with conditional conformance to
35+
`Collection`, `BidirectionalCollection`, and `RandomAccessCollection` when both
36+
the first and second arguments conform. `Chain` also conforms to
37+
`LazySequenceProtocol` when the first argument conforms.
3838

3939
### Naming
4040

Guides/Combinations.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ Since the `Combinations` type needs to store an array of the collection’s
5151
indices and mutate the array to generate each permutation, `Combinations` only
5252
has `Sequence` conformance. Adding `Collection` conformance would require
5353
storing the array in the index type, which would in turn lead to copying the
54-
array at every index advancement.
54+
array at every index advancement. `Combinations` does conform to
55+
`LazySequenceProtocol` when the base type conforms.
5556

5657
### Complexity
5758

Guides/Cycle.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ extension Collection {
3333
```
3434

3535
The new `Cycle` type is a sequence only, given that the `Collection` protocol
36-
design makes infinitely large types impossible/impractical. Note that despite
37-
its name, the returned `FlattenSequence` will always have `Collection`
38-
conformance, and will have `BidirectionalCollection` conformance when called on
39-
a bidirectional collection.
36+
design makes infinitely large types impossible/impractical. `Cycle` also
37+
conforms to `LazySequenceProtocol` when the base type conforms.
38+
39+
Note that despite its name, the returned `FlattenSequence` will always have
40+
`Collection` conformance, and will have `BidirectionalCollection` conformance
41+
when called on a bidirectional collection.
4042

4143
### Complexity
4244

Guides/Indexed.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@ extension Collection {
3030
```
3131

3232
`Indexed` scales from a collection up to a random-access collection, depending on
33-
its base type.
33+
its base type. `Indexed` also conforms to `LazySequenceProtocol` when the base type
34+
conforms.
3435

Guides/Permutations.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ Since the `Permutations` type needs to store an array of the collection’s
7575
indices and mutate the array to generate each permutation, `Permutations` only
7676
has `Sequence` conformance. Adding `Collection` conformance would require
7777
storing the array in the index type, which would in turn lead to copying the
78-
array at every index advancement.
78+
array at every index advancement. `Combinations` does conform to
79+
`LazySequenceProtocol` when the base type conforms.
7980

8081
### Complexity
8182

0 commit comments

Comments
 (0)