import algorithm var v = [1, 2, 3] # List has to start sorted echo v while v.nextPermutation(): echo v