@@ -68,13 +68,13 @@ public struct FlattenIterator<Base : IteratorProtocol> : IteratorProtocol, Seque
6868/// The elements of this view are a concatenation of the elements of
6969/// each sequence in the base.
7070///
71- /// The `flatten` property is always lazy, but does not implicitly
71+ /// The `joined` method is always lazy, but does not implicitly
7272/// confer laziness on algorithms applied to its result. In other
7373/// words, for ordinary sequences `s`:
7474///
75- /// * `s.flatten ()` does not create new storage
76- /// * `s.flatten ().map(f)` maps eagerly and returns a new array
77- /// * `s.lazy.flatten ().map(f)` maps lazily and returns a `LazyMapSequence`
75+ /// * `s.joined ()` does not create new storage
76+ /// * `s.joined ().map(f)` maps eagerly and returns a new array
77+ /// * `s.lazy.joined ().map(f)` maps lazily and returns a `LazyMapSequence`
7878///
7979/// - See also: `FlattenCollection`
8080public struct FlattenSequence < Base : Sequence > : Sequence
@@ -113,8 +113,8 @@ extension Sequence where Iterator.Element : Sequence {
113113 /// // Prints "8..<10"
114114 /// // Prints "15..<17"
115115 ///
116- /// // Use 'flatten ()' to access each element of each range:
117- /// for index in ranges.flatten () {
116+ /// // Use 'joined ()' to access each element of each range:
117+ /// for index in ranges.joined () {
118118 /// print(index, terminator: " ")
119119 /// }
120120 /// // Prints: "0 1 2 8 9 15 16"
@@ -123,9 +123,14 @@ extension Sequence where Iterator.Element : Sequence {
123123 /// sequence of sequences.
124124 ///
125125 /// - SeeAlso: `flatMap(_:)`, `joined(separator:)`
126- public func flatten ( ) -> FlattenSequence < Self > {
126+ public func joined ( ) -> FlattenSequence < Self > {
127127 return FlattenSequence ( _base: self )
128128 }
129+
130+ @available ( * , unavailable, renamed: " joined() " )
131+ public func flatten( ) -> FlattenSequence < Self > {
132+ Builtin . unreachable ( )
133+ }
129134}
130135
131136extension LazySequenceProtocol
@@ -134,11 +139,16 @@ extension LazySequenceProtocol
134139 Iterator. Element : Sequence {
135140
136141 /// A concatenation of the elements of `self`.
137- public func flatten ( ) -> LazySequence <
142+ public func joined ( ) -> LazySequence <
138143 FlattenSequence < Elements >
139144 > {
140145 return FlattenSequence ( _base: elements) . lazy
141146 }
147+
148+ @available ( * , unavailable, renamed: " joined() " )
149+ public func flatten( ) -> LazySequence < FlattenSequence < Elements > > {
150+ Builtin . unreachable ( )
151+ }
142152}
143153
144154% for traversal in [ 'Forward', 'Bidirectional'] :
@@ -209,13 +219,13 @@ extension ${Index} : Comparable {
209219/// The elements of this view are a concatenation of the elements of
210220/// each collection in the base.
211221///
212- /// The `flatten` property is always lazy, but does not implicitly
222+ /// The `joined` method is always lazy, but does not implicitly
213223/// confer laziness on algorithms applied to its result. In other
214224/// words, for ordinary collections `c`:
215225///
216- /// * `c.flatten ()` does not create new storage
217- /// * `c.flatten ().map(f)` maps eagerly and returns a new array
218- /// * `c.lazy.flatten ().map(f)` maps lazily and returns a `LazyMapCollection`
226+ /// * `c.joined ()` does not create new storage
227+ /// * `c.joined ().map(f)` maps eagerly and returns a new array
228+ /// * `c.lazy.joined ().map(f)` maps lazily and returns a `LazyMapCollection`
219229///
220230/// - Note: The performance of accessing `startIndex`, `first`, any methods
221231/// that depend on `startIndex`, or of advancing a `${Collection}Index`
@@ -381,8 +391,8 @@ extension ${collectionForTraversal(traversal)}
381391 /// // Prints "8..<10"
382392 /// // Prints "15..<17"
383393 ///
384- /// // Use 'flatten ()' to access each element of each range:
385- /// for index in ranges.flatten () {
394+ /// // Use 'joined ()' to access each element of each range:
395+ /// for index in ranges.joined () {
386396 /// print(index, terminator: " ")
387397 /// }
388398 /// // Prints: "0 1 2 8 9 15 16"
@@ -391,9 +401,14 @@ extension ${collectionForTraversal(traversal)}
391401 /// collection of collections.
392402 ///
393403 /// - SeeAlso: `flatMap(_:)`, `joined(separator:)`
394- public func flatten ( ) - > ${ Collection} < Self> {
404+ public func joined ( ) - > ${ Collection} < Self> {
395405 return ${ Collection} ( self )
396406 }
407+
408+ @available ( * , unavailable, renamed: " joined() " )
409+ public func flatten( ) -> ${ Collection} < Self> {
410+ Builtin . unreachable ( )
411+ }
397412}
398413
399414extension LazyCollectionProtocol
@@ -404,9 +419,14 @@ extension LazyCollectionProtocol
404419 ${ constraints % { 'Base': 'Elements. '} } ,
405420 Iterator . Element == Elements . Iterator. Element {
406421 /// A concatenation of the elements of `self`.
407- public func flatten ( ) - > LazyCollection< ${ Collection} < Elements>> {
422+ public func joined ( ) - > LazyCollection< ${ Collection} < Elements>> {
408423 return ${ Collection} ( elements) . lazy
409424 }
425+
426+ @available ( * , unavailable, renamed: " joined() " )
427+ public func flatten( ) -> LazyCollection < ${ Collection} < Elements>> {
428+ Builtin . unreachable ( )
429+ }
410430}
411431
412432% end
0 commit comments