File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
Whats-new-in-Swift-4.playground/Pages
Generic subscripts.xcplaygroundpage
reduce with inout.xcplaygroundpage Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ let population: Int? = json["population"]
34
34
Another example: a subscript on `Collection` that takes a generic sequence of indices and returns an array of the values at these indices:
35
35
*/
36
36
extension Collection {
37
- subscript< Indices: Sequence > ( indices indices: Indices ) -> [ Iterator . Element ] where Indices. Iterator . Element == Index {
37
+ subscript< Indices: Sequence > ( indices indices: Indices ) -> [ Element ] where Indices. Element == Index {
38
38
var result : [ Element ] = [ ]
39
39
for index in indices {
40
40
result. append ( self [ index] )
Original file line number Diff line number Diff line change 10
10
SE-0171 is not implemented yet.
11
11
*/
12
12
// Not implemented yet
13
- //extension Sequence where Iterator. Element: Equatable {
14
- // func uniq() -> [Iterator. Element] {
15
- // return reduce(into: []) { (result: inout [Iterator. Element], element) in
13
+ //extension Sequence where Element: Equatable {
14
+ // func uniq() -> [Element] {
15
+ // return reduce(into: []) { (result: inout [Element], element) in
16
16
// if result.last != element {
17
17
// result.append(element)
18
18
// }
You can’t perform that action at this time.
0 commit comments