I need to remove the reverse versions of lists from list of lists. I.e.: {{1,2},{2,2},{2,1},{a,1,2},{2,1,a}} I need to reduce to {{1,2},{2,2},{a,1,2}}.
The requirement to remove only the reverse of a given list means that permutations other than the reverse will be conserved, so that
{{1,2,3},{2,1,3},{3,2,1},{1,2,2},{a,1,2},{2,1,a}}
should reduce to
{{1,2,3},{2,1,3},{1,2,2},{a,1,2}}
My try gives correct result but it use nested For which is not too nice. Does anyone know of a better way to do it?
Union[Sort /@ {{1, 2}, {2, 2}, {2, 1}, {a, 1, 2}}]– Peltio Nov 08 '13 at 13:36{{1,2,3}, {3,1,2}}should not be reduced and it will be with your method. – Kuba Nov 08 '13 at 14:13Unionfor an efficient solution. The question is: what efficiently computable canonical form can we use? (I.e. a way to unambiguously choose eitherlistorReverse[list]for each item.) – Szabolcs Nov 08 '13 at 14:19