dims
The dimensions of a matrix for which we need the possible indices for each dimension. For exemple, if the dimensions sent are c(3,2,5), the following list of arrays will be generated:
list(c(1:3), c(1:2), c(1:5))
lenlist
lenlist is the length of the list because the list will be complemented above length(dims) by arrays of length 1.
For example, if lenlist is set to 7, the previous list of arrays will be extended to:
list(c(1:3), c(1:2), c(1:5), 1, 1, 1, 1)