Skip to content
This repository has been archived by the owner on Dec 1, 2019. It is now read-only.

Commit

Permalink
Merge pull request #3 from jpsim/jp-sequence-element
Browse files Browse the repository at this point in the history
remove unnecessary indirection
  • Loading branch information
ole committed May 26, 2017
2 parents 7e14bfd + 20c5f7f commit 76b5189
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ let population: Int? = json["population"]
Another example: a subscript on `Collection` that takes a generic sequence of indices and returns an array of the values at these indices:
*/
extension Collection {
subscript<Indices: Sequence>(indices indices: Indices) -> [Iterator.Element] where Indices.Iterator.Element == Index {
subscript<Indices: Sequence>(indices indices: Indices) -> [Element] where Indices.Element == Index {
var result: [Element] = []
for index in indices {
result.append(self[index])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
SE-0171 is not implemented yet.
*/
// Not implemented yet
//extension Sequence where Iterator.Element: Equatable {
// func uniq() -> [Iterator.Element] {
// return reduce(into: []) { (result: inout [Iterator.Element], element) in
//extension Sequence where Element: Equatable {
// func uniq() -> [Element] {
// return reduce(into: []) { (result: inout [Element], element) in
// if result.last != element {
// result.append(element)
// }
Expand Down

0 comments on commit 76b5189

Please sign in to comment.