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])
Set([:c])
explicit specification of the array elements inside union() gives what I want
union(x[1],x[2])
---
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])
Set(Symbol[:c])
How can I use the list comprehension in a way that union gives one resulting set ?