Using union() and list comprehesions

I have two-element array whose elements are Sets, x = [ Set([:a,:b,:c]), Set([:c]) ], I would like to make union of the array elements as one resulting set, Set([:a, :b, :c]). I am having issue with union and iterate using list comprehensions over the array elements, Is there a better way to handle it?

x = [ Set([:a,:b,:c]), Set([:c]) ]
union( x )
2-element Array{Set{Symbol},1}:
 Set([:a, :b, :c])

explicit specification of the array elements inside union() gives what I want

Set(Symbol[:a, :b, :c])

However, to automate it, I tried list comprehension, but it did not work

union( [x[i] for i in 1:2] )
Set(Symbol[:a, :b, :c])

How can I use the list comprehension in a way that union gives one resulting set ?

You can do

julia> union(x...)
Set{Symbol} with 3 elements:

Using ... is called “splatting”.


It resolves, thanks.