Created
September 11, 2017 14:43
-
-
Save adamchalmers/13546ff168d805c06f46d078830906a6 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
func extend<T: Collection, U: Collection>(_ base: T, withNewElems: U) -> [T.Iterator.Element] | |
where T.Iterator.Element == U.Iterator.Element { | |
let newElems = withNewElems.filter { !base.contains($0) } | |
return Array(base) + newElems | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment