Hello everyone. Can anyone help me see why result 1 and 2 are different. Thank you.
u = [1,0]
d = [0,1]
N = 2
base = ntuple(i->[u,d],N)
# result 1
for q in Iterators.product(base)
# result 2 <-- correct
for q in Iterators.product([u,d],[u,d])
It’s a different thing to pass one argument which is a 2-tuple of arrays, or to pass two arguments which are both arrays. You can splat the first tuple into multiple arguments, then it does the same thing as the other version
for q in Iterators.product(base...)
I was already rephrasing the question, when I decided to test your suggestion. I thought the “…” was just a ellipsis sign. What is the meaning of “…” after the arguments?
it’s the splatting operation.