I have encountered the absence of an !∈ or !in operator many times now and my muscle memory insists on telling me that it should exist:
if a !in (b, c, d)
...
end
Why isn’t there an analogous operator/function for this very idiomatic construct? IMHO, it is much, much clearer to understand and process than writing
if !(a in (b, c, d))
...
end
and intuitively it wouldn’t be slower either. Was this a conscious decision to not have the negation of in/∈ or are there other reasons?
Ah, I didn’t know about that! Good point, but isn’t there anything for people who cannot use non-ASCII characters? It seems weird that there is an imbalance with ∉ existing but !in not?
I agree that there is merit in finding a general solution. However, I think in is somewhat special as there already exists a non-ASCII equivalent, so to me it is not understandable why !in is not treated the same way.