In.([string], Set)) not work , why?

I need to keep sorting the vector [zawartosc] and can’t use intersect ()
Why

in.([string], Set)) 

not works

julia> in(zawartosc[1],Sunikalne)
true

julia> in.(zawartosc,Sunikalne)
ERROR: DimensionMismatch("arrays could not be broadcast to a common size")
Stacktrace:
 [1] _bcs1 at .\broadcast.jl:439 [inlined]
 [2] _bcs at .\broadcast.jl:433 [inlined]
 [3] broadcast_shape at .\broadcast.jl:427 [inlined]
 [4] combine_axes at .\broadcast.jl:422 [inlined]
 [5] instantiate at .\broadcast.jl:266 [inlined]
 [6] materialize(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArraySt
{String,1},Array{String,1}}}) at .\broadcast.jl:756
 [7] top-level scope at none:0

julia> zawartosc
3229-element Array{String,1}:

julia> typeof(zawartosc)
Array{String,1}

julia> typeof(Sunikalne)
Set{String}

Paul

1 Like

Can you provide a minimum reproducible example? You haven’t defined you inputs so we can test.

1 Like

I think you want in.(zawartosc,Ref(Sunikalne)) — this tells Julia to treat Sunikalne as a “scalar” for the purposes of broadcasting, instead of trying to iterate over its contents.

3 Likes

Thanks, very usefull for future!
Paul