俩集合相对补集运算

给定集合A和集合B,它们的交集和并集可以通过下面的运算实现,那么求A在B中的相对补集怎么操作啊

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

julia> B = ["b", "c", "d"]
3-element Array{String,1}:
 "b"
 "c"
 "d"

julia> A∩B
2-element Array{String,1}:
 "b"
 "c"

julia> A∪B
4-element Array{String,1}:
 "a"
 "b"
 "c"
 "d"

可以通过下面函数实现,我想问的是julia中有没有相应的操作符来操作啊

julia> filter(x->x∉A, B)
1-element Array{String,1}:
 "d"
julia> setdiff(B, A)
1-element Vector{String}:
 "d"

这样吗?

3 个赞

many THX