Suppose I have a list of lists
L= [[1,2,3], [3,2,1],[2,1,2],[3,1,2], [1,2,2]].
as you can see, [1,2,3]
,[3,2,1]
and [3,1,2]
are permutations of each other.
[2,1,2]
and [1,2,2]
are also permutations of each other.
My goal is to remove all permutations of elements in the list. the result list should be:
L'=[[1,2,3],[2,1,2]].
My idea so far is use member(X,L) to locate an element in the list, then use permutation(X,Xperm)
to get a permutation of X
, then check if Xperm
is in L
, and if so ,delete it.
However the result turns out not to be what I wanted.
Could anyone help me?