I want to check elementwise (or broadcast) if the elements of vector x are in the vector y in Julia like what the function checkin
does:
x = ["one", "two", "three", "four"]
y = ["two", "three", "five", "four"]
function checkin(x,y)
for i = 1:length(y)
if y[i] ∈ x
println(true)
else
println(false)
end
end
end
checkin(x,y)
output:
true
true
false
true
If I type
x .∈ y
or
x .in y
I get an error
As often, I'm sure that there exist a much easier way to do it as writting a 9 line function, but I couldn't find it