func anyCommonElements (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])
练习: 修改anyCommonElements(_:_:)函数来创建一个函数,返回一个数组,内容是两个序列的共有元素。