Created
April 19, 2018 01:48
-
-
Save natecook1000/1b3ece02f15ef04ef302ed842cb07ba8 to your computer and use it in GitHub Desktop.
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 BidirectionalCollection { | |
| func drop(first: Int, last: Int) -> SubSequence { | |
| return self.dropFirst(first).dropLast(last) | |
| } | |
| } | |
| let numbers = 0..<10 | |
| numbers.drop(first: 1, last: 1) // 1..<9 | |
| numbers.drop(first: 2, last: 4) // 2..<6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🤔 Maybe because if we extend
Collectionwe'd be able to dowhich does not seem to make much sense