musique/examples/permutations.mq

12 lines
193 B
Plaintext

factorial := (n | fold (1 + up n) '*);
list_all_permutations := ( array |
for (up (factorial (len array))) (|
say array;
array = permute array;
);
);
list_all_permutations (1 + up 5);