以下代码在Swift 3中编译
extension Array where Element: Equatable {
var removeDuplicate: [Element] {
return reduce([]){ $0.0.contains($0.1) ? $0.0 : $0.0 + [$0.1] }
}
}
Run Code Online (Sandbox Code Playgroud)
但会产生错误
错误:上下文闭包类型'(_,_) - > _'需要2个参数,但在闭包体中使用了1
在Swift 4.如何转换此代码以在Swift 4中编译?