musique/examples/permutations.mq
2022-10-27 22:32:20 +02:00

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),