Creating iterators for tuples of arbitrary dimension

Maybe I don’t understand the question, but some variant of

d = 2
[sum(Tuple(ι)) for ι in CartesianIndices(ntuple(_ -> 1:10, d))]

should work (make d a Val type for type stability and/or wrap in a vec or flatten if needed, etc).

2 Likes