Selecting the Set from an Array of integers

I have the Array
A=[0,0,0,2,1,0,1,3,2,3,4,5,1,7,1]
for which the Set is
S=[0,1,2,3,4,5,7]

Set(A) doesn’t work in that I get an object Set([…]), but the resulting thing should still be an Array as before. How do I do this?

julia> A=[0,0,0,2,1,0,1,3,2,3,4,5,1,7,1];

julia> unique(A)
7-element Array{Int64,1}:
 0
 2
 1
 3
 4
 5
 7
2 Likes

For cases where it doesn’t work out as neatly, here an uglier but maybe more universal method:

julia> Set([1, 1, 2, 3])
Set([2, 3, 1])

julia> Set([1, 1, 2, 3]) |> collect
3-element Array{Int64,1}:
 2
 3
 1