Cartesian Product Iterator from a Matrix

I would like to take a matrix, A, and iterate over the Cartesian product of its entries. I can easily do this by

for (a,b,c) in Iterators.product(A[:,1], A[:,2], A[:,3])
    println("$a, $b, $c")
end 

But what I would ideally like is something along the lines of

for (a,b,c,...) in Iterators.product(for col in eachcol(A))
    println("$a, $b, $c,...")
end 

(which obviously doesn’t work but you get the idea I hope) for an N by N matrix. I don’t know if this is even possible. If anyone can provide some advice I would be very grateful.

Does something like

for x in Iterators.product(eachcol(A)...)
    println("$x")
end 

help?

Does it need to be in column order? Here’s a very simple thing that might be giving what you want:

va = vec(A)
for (aj, ak) in Iterators.product(va, va)
  [...]
end

If you do want something that specifically works with columns, it might be worth considering doing something that is readable and easy like

col_range = 1:size(A,2)
for (j, k) in Iterators.product(1:col_range, 1:col_range)
  cj = A[:,j]
  ck = A[:,k]
  [...]
end