Created
November 3, 2020 02:01
-
-
Save masakih/296241d991e619c0e90ede6f4581891e to your computer and use it in GitHub Desktop.
Indexへの制約を外したのでStringに直接使える #CodePiece
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension Collection { | |
| func list3() -> [[Element]] { | |
| zip(0..., self).flatMap { (i: Int, e0: Element) -> [[Element]] in | |
| zip((i + 1)..., self[index(startIndex, offsetBy: (i + 1))...]).flatMap { (j: Int, e1: Element) -> [[Element]] in | |
| self[index(startIndex, offsetBy: (j + 1))...].map { (e2: Element) -> [Element] in | |
| [e0, e1, e2] | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment