Created
November 12, 2017 08:01
-
-
Save LH17/33b18f14b5773bbac42a0fe7f6c9562c to your computer and use it in GitHub Desktop.
This file contains 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
precedencegroup UnionOperatorPrecedence { | |
associativity: left | |
} | |
infix operator ∪: UnionOperatorPrecedence | |
func ∪ <T:Equatable>(lhs: [T], rhs:[T])->[T] { | |
var result = lhs | |
for element in rhs { | |
if !lhs.contains(element) { | |
result.append(element) | |
} | |
} | |
return result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment