I need to sort a list and learn whether the resulting permutation is even or odd. My lists are short but I am tempermentally incapable of inefficient algorithms. After some thought I decided to attach consecutive numbers to consecutive list elements, sort them keeping the attached numbers, extract the numbers from the sorted list, and test the parity of the extracted numbers as a permutation. To find this parity I decompose the permutation into disjoint cycles. Odd length cycles are even permutations and vice-versa. The parity of the permutation is the product of the parities of the cycles. See this for sort code.
Terms permutation [parity | sign | signature]
parity sort

as homomorphism to G(2)

Seeking solution, but with different constraint rules. (within Maple)

Haskell solution?
See my ocaml notes.