I understand that if I want to test if a given value is present in an array, I can use:
value in array
However, how do I go about testing if a given value is not in an array? So far, the only solution I could come up with is:
!(value in array)
Is there anything similar to using “not in” as in Python?
∉, which you can get by typing
\notin<tab>. There doesn’t seem to be an ascii equivalent.
While this particular one has a Unicode shorthand as pointed out by @pdeffebach, generally it is not good design to introduce two functions for
!predicate(args...) — that’s why we have
!(a in b) is fine.
Thanks for the replies everyone. And thanks for the link to the discussion thread DNF. I was driving myself crazy thinking there was already a clear way to do this and I just couldn’t find it documented anywhere.
I take it that this is still an ongoing topic?