Created
June 2, 2014 21:27
-
-
Save jonfriskics/42620923a79b87017468 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
func anyCommonElements <T, U where T: Sequence, U: Sequence, T.GeneratorType.Element: Equatable, T.GeneratorType.Element == U.GeneratorType.Element> (lhs: T, rhs: U) -> Bool { | |
for lhsItem in lhs { | |
for rhsItem in rhs { | |
if lhsItem == rhsItem { | |
return true | |
} | |
} | |
} | |
return false | |
} | |
anyCommonElements([1, 2, 3], [3]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment