musique/regression-tests/builtin/permute.mq
2022-10-27 22:32:20 +02:00

34 lines
777 B
Plaintext

-- 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),
-- This array should be flattened to support case (permute array)
say (permute 3 2 (1, 0)),
-- Test if nested arrays are preserved
say (permute ((3, 2), 4) (1, 0)),
say (permute (0, 1, 4, (3, 2))),