Is there an easy way to write a generator to generate all lists that are k elements long, where each element ranges from 1 to n?
So if k=3 and n=3, it would generate
[1,1,1]
[1,1,2]
[1,1,3]
[1,2,1]
[1,2,2]
[1,2,3]
[1,3,1]
...
[3,3,1]
[3,3,2]
[3,3,3]