musique/examples/permutations.mq

12 lines
193 B
Plaintext
Raw Permalink Normal View History

factorial := (n | fold '* (1 + up n)),
2022-06-02 23:17:02 +02:00
list_all_permutations := ( array |
for (up (factorial (len array))) (|
say array,
array = permute array,
),
),
list_all_permutations (1 + up 5),