| Author |
Comment/Response |
Ben Smith
|
10/31/11 09:56am
So I have a list that is, well, huge. The data looks like this:
{{"Australia", "Austria"}, {"Australia", "Belgium"}, {"Australia",
"Canada"} ......
In the context of my problem, Austria to Belgium is the same as Belgium to Austria. So, I want to delete duplicates based on that criteria.
DeleteDuplicates[
MAINLIST, (ToString[Extract[#1, {1}]] ==
ToString[Extract[#2, {1}]] &&
ToString[Extract[#1, {2}]] ==
ToString[Extract[#2, {2}]]) || (ToString[Extract[#1, {2}]] ==
ToString[Extract[#2, {1}]] &&
ToString[Extract[#1, {1}]] == ToString[Extract[#2, {2}]]) &];
However when I do a length on MAINLIST before and after the deletion process, there is exactly the same number of elements.
Does anyone know what I'm doing wrong?
URL: , |
|