Created
April 12, 2018 04:03
-
-
Save omochi/b9395558f4c68ed11a56b01ab8de1a89 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 Array { | |
public mutating func remove(where: (Element) -> Bool) { | |
while let index = self.index(where: `where`) { | |
remove(at: index) | |
} | |
} | |
public func removed(where: (Element) -> Bool) -> [Element] { | |
var copy = self | |
copy.remove(where: `where`) | |
return copy | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment