+1 for toggle, seems the clear winner for me.

> On Jan 12, 2018, at 8:29 AM, Cheyo Jimenez via swift-evolution 
> <swift-evolution@swift.org> wrote:
> 
> It’s a slippery slope because it makes me want to have something like `not()` 
> added to the library. I don’t think it’s worth it. 
> 

I would love to have not(), but for a different purpose:

func not<T>(_ predicate: @escaping (T)->Bool) -> (T)->Bool {
  return { !predicate($0) }
}

let noScrubs = guys.filter(not(isBusta))

I guess you could overload a version of ! for predicates but that doesn’t seem 
wise.


_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to