Then this might help:
julia> collect(Combinatorics.with_replacement_combinations([0,1,3],3))
10-element Array{Array{Int64,1},1}:
[0, 0, 0]
[0, 0, 1]
[0, 0, 3]
[0, 1, 1]
[0, 1, 3]
[0, 3, 3]
[1, 1, 1]
[1, 1, 3]
[1, 3, 3]
[3, 3, 3]
Although this doesn’t satisfy length(A)^dimension
. Or as mforets has mentioned:
julia> a = [0,1,3]
julia> collect(Iterators.product(a,a,a))
3×3×3 Array{Tuple{Int64,Int64,Int64},3}:
[:, :, 1] =
(0, 0, 0) (0, 1, 0) (0, 3, 0)
(1, 0, 0) (1, 1, 0) (1, 3, 0)
(3, 0, 0) (3, 1, 0) (3, 3, 0)
[:, :, 2] =
(0, 0, 1) (0, 1, 1) (0, 3, 1)
(1, 0, 1) (1, 1, 1) (1, 3, 1)
(3, 0, 1) (3, 1, 1) (3, 3, 1)
[:, :, 3] =
(0, 0, 3) (0, 1, 3) (0, 3, 3)
(1, 0, 3) (1, 1, 3) (1, 3, 3)
(3, 0, 3) (3, 1, 3) (3, 3, 3)