How can I define the following funtion
/* Curry `all()` using `predicate` */
public func allUsing <S: SequenceType> (@noescape predicate: (S.Generator.Element) -> Bool) (_ source: S) -> Bool {
return source.all (predicate) // Assume `all()` on SequenceType exists
}Such that a use like this is possible:
var allEven = allUsing ({ (x:Int) -> Bool in return 0 == x % 2 })
// cannot convert value of type 'Int -> Bool' to expected argument type '(_) -> Bool'
allEven([0, 1, 2]) // -> false
allEven([2, 4, 6]) // -> trueSeems the result of `allUsing()` from above ought to be typed as if:
func allEven (S:SequenceType where Int == S.Generator.Element) (_ source: S) -> Boolbut it is not.