Last active
May 15, 2019 11:45
-
-
Save hsleedevelop/350bcacf16bce7459d1dfb56638aebeb to your computer and use it in GitHub Desktop.
likeReshapes
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
| let half = round(list.count.d / 2.d).i | |
| let reshapes = (list[0...half].map { $0 }, list[half..<list.count].map { $0 }) | |
| self.list = (0..<half).flatMap { i -> [HomeDataType] in [reshapes.0[i]] + (i < reshapes.1.count ? [reshapes.1[i]] : []) } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ex) [1, 2, 3, 4, 5, 6, 7, 8] -> [1, 5, 2, 6, 3, 7, 4, 8]