Whos element of vector y is in Set x

I have a long vectros of strings. How to do this fasastest ?

julia> x=["a" "b"]
1×2 Array{String,2}:
 "a"  "b"

julia> x=["a", "b"]
2-element Array{String,1}:
 "a"
 "b"

julia> y=["a","c","b","a","b"]
5-element Array{String,1}:
 "a"
 "c"
 "b"
 "a"
 "b"

julia> y in Set(x)
false

julia> y in. Set(x)
ERROR: syntax: invalid identifier name "."
Stacktrace:
 [1] top-level scope at none:1

julia> y .in Set(x)
ERROR: syntax: space before "." not allowed in "y ." at REPL[6]:1
Stacktrace:
 [1] top-level scope at none:1

julia> false
false'''

Paul

in(Set(x)).(y)

2 Likes

Or

in.(y, (Set(x),))

or

y .∈ (Set(x),)
1 Like

equivalently:

y .∈ Ref(Set(x))

My preferred in this case:

map(in(Set(x)), y) # or  map(∈(Set(x)), y)
3 Likes