Skip to content

Commit fc2f02d

Browse files
committed
Add conditional LazySequenceProtocol conformance where appropriate
1 parent 73c4a21 commit fc2f02d

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

Sources/Algorithms/Chain.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ extension Chain: BidirectionalCollection
250250

251251
extension Chain: RandomAccessCollection
252252
where Base1: RandomAccessCollection, Base2: RandomAccessCollection {}
253+
extension Chain: LazySequenceProtocol where Base1: LazySequenceProtocol {}
253254

254255
extension Chain: Equatable where Base1: Equatable, Base2: Equatable {}
255256
extension Chain: Hashable where Base1: Hashable, Base2: Hashable {}

Sources/Algorithms/Combinations.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ extension Combinations: Sequence {
111111
}
112112
}
113113

114+
extension Combinations: LazySequenceProtocol where Base: LazySequenceProtocol {}
114115
extension Combinations: Equatable where Base: Equatable {}
115116
extension Combinations: Hashable where Base: Hashable {}
116117

Sources/Algorithms/Cycle.swift

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ extension Cycle: Sequence {
3838
}
3939
}
4040

41+
extension Cycle: LazySequenceProtocol where Base: LazySequenceProtocol {}
42+
4143
//===----------------------------------------------------------------------===//
4244
// cycled()
4345
//===----------------------------------------------------------------------===//
@@ -71,13 +73,7 @@ extension Collection {
7173
public func cycled() -> Cycle<Self> {
7274
Cycle(base: self)
7375
}
74-
}
75-
76-
//===----------------------------------------------------------------------===//
77-
// repeated(count:)
78-
//===----------------------------------------------------------------------===//
79-
80-
extension Collection {
76+
8177
/// Returns a sequence that repeats the elements of this collection the
8278
/// specified number of times.
8379
///

Sources/Algorithms/Indexed.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,14 @@ extension Indexed: BidirectionalCollection where Base: BidirectionalCollection {
5656
}
5757

5858
extension Indexed: RandomAccessCollection where Base: RandomAccessCollection {}
59+
extension Indexed: LazySequenceProtocol where Base: LazySequenceProtocol {}
5960
extension Indexed: Equatable where Base: Equatable {}
6061
extension Indexed: Hashable where Base: Hashable {}
6162

63+
//===----------------------------------------------------------------------===//
64+
// indexed()
65+
//===----------------------------------------------------------------------===//
66+
6267
extension Collection {
6368
/// Returns a collection of pairs *(i, x)*, where *i* represents an index of
6469
/// the collection, and *x* represents an element.

Sources/Algorithms/Permutations.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ extension Permutations: Sequence {
129129
}
130130
}
131131

132+
extension Permutations: LazySequenceProtocol where Base: LazySequenceProtocol {}
133+
132134
//===----------------------------------------------------------------------===//
133135
// nextPermutation(by:)
134136
//===----------------------------------------------------------------------===//
@@ -177,7 +179,7 @@ extension MutableCollection
177179
}
178180

179181
//===----------------------------------------------------------------------===//
180-
// permutations(count:)
182+
// permutations(ofCount:)
181183
//===----------------------------------------------------------------------===//
182184

183185
extension Collection {

0 commit comments

Comments
 (0)