I want to use set()
as in python in Julia. Is it possible to do so? If yes, please provide an example using the following python code
set(A) - set(B)
The relevant functionality is explained in the docs. While you can still use -
, it's been deprecated:
julia> A = [1,2,3]; B = [2,3,4];
julia> Set(A) - Set(B)
WARNING: a::Set - b::Set is deprecated, use setdiff(a,b) instead.
in - at deprecated.jl:26
Set{Int32}({1})
julia> setdiff(A, B)
1-element Array{Int32,1}:
1
julia> setdiff(Set(A), Set(B))
Set{Int32}({1})
Note that we can use setlike ops on arrays directly, in which case they're order-preserving.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With