As reported in the Julia documentation, the in, ∈, ∋, ∉, ∌ functions “determine whether an item is in the given collection, in the sense that it is == to one of the values generated by iterating over the collection”.
I need to filter out all entries of a dictionary with value equal to either nothing or false. The following command filters out also entries with value equal to 0, which instead I need to keep:
a = Dict("a"=>1, "b"=>0, "c"=>false, "d"=>2, "e"=>"test", "f"=>nothing)
filter(x -> x.second ∉ (false, nothing), a)
This is a possible workaround:
filter(x -> x.second !== false && x.second !== nothing, a)
but in my opinion it would be useful to define analogous functions working in the === sense, which could for instance be named in=, ∈=, ∋=, ∉=, ∌=. Their documentation would also better clarify how in, ∈, ∋, ∉, ∌ behave in these cases, helping to avoid similar bugs.
(That allocates a temporary array (to pass to any ) for every element x of a, which is pretty inefficient for large a. Though it’s not clear that the original poster cares about performance here.)