Iterator over variable number of arguments

Does this do what you want?

julia> n=3
3

julia> collect(Iterators.product([[1,-1] for i=1:n]...))
8-element Array{Tuple{Int64,Int64,Int64},1}:
 (1,1,1)   
 (-1,1,1)  
 (1,-1,1)  
 (-1,-1,1) 
 (1,1,-1)  
 (-1,1,-1) 
 (1,-1,-1) 
 (-1,-1,-1)
1 Like