This question may have a simple answer, but I can't find it anywhere in the documentation. I'm trying to find a function that tells me whether a list is a permutation of another list. So the function should behave like this:
TestPermutation[{1, 2, 3, 4}, {1, 3, 2, 4}] (* Should return True *)
TestPermutation[{1, 2, 3, 4}, {1, 1, 2, 4}] (* Should return False *)
What sort of works is to use FindPermutation[list1, list2], and then catch the error that says e.g.:
FindPermutation::norel: Expressions {1,2,3} and {2,1,2} cannot be related by a permutation. >>
But that isn't a very nice solution. Is there a neat way do do this?