Last active
May 30, 2018 20:08
-
-
Save adamchalmers/4e96256b440942b5e41cb16b725462d1 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, | |
T.Iterator.Element: Equatable { | |
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