musique/regression-tests/builtin/permute.mq

34 lines
777 B
Plaintext
Raw Permalink Normal View History

2022-09-25 03:19:00 +02:00
-- 4! = 24 permutations
say (permute 0 1 2 3),
say (permute 0 1 3 2),
say (permute 0 2 1 3),
say (permute 0 2 3 1),
say (permute 0 3 1 2),
say (permute 0 3 2 1),
say (permute 1 0 2 3),
say (permute 1 0 3 2),
say (permute 1 2 0 3),
say (permute 1 2 3 0),
say (permute 1 3 0 2),
say (permute 1 3 2 0),
say (permute 2 0 1 3),
say (permute 2 0 3 1),
say (permute 2 1 0 3),
say (permute 2 1 3 0),
say (permute 2 3 0 1),
say (permute 2 3 1 0),
say (permute 3 0 1 2),
say (permute 3 0 2 1),
say (permute 3 1 0 2),
say (permute 3 1 2 0),
say (permute 3 2 0 1),
say (permute 3 2 1 0),
2022-09-25 03:19:00 +02:00
-- This array should be flattened to support case (permute array)
say (permute 3 2 (1, 0)),
2022-09-25 03:19:00 +02:00
-- Test if nested arrays are preserved
say (permute ((3, 2), 4) (1, 0)),
say (permute (0, 1, 4, (3, 2))),