Skip to main content
Post Undeleted by E. Chan-López
added 22 characters in body
Source Link
E. Chan-López
  • 31.2k
  • 3
  • 29
  • 50

Using ReplacePartDelete and Position to delete cases from newD:

l1 = listF;
l2 = newD;
ReplacePart[l2
Delete[l2, Catenate[Position[l2Position[l2, #] &Alternatives /@@@ (Join[#, Reverse /@ #] &@l1)] -> Nothing]&@l1]]

(*{{{7, 9}, {9, 2}}, {{6, 7}}, {{6, 7}}, {{2, 11}}, {{7, 8}}, {{11, 1}}, {{1, 5}, {5, 7}}, 
{{7, 8}}, {{11, 1}}, {{8, 6}}, {{2, 11}}, {{8, 6}}}*)

Using ReplacePart:

l1 = listF;
l2 = newD;
ReplacePart[l2, Catenate[Position[l2, #] & /@ (Join[#, Reverse /@ #] &@l1)] -> Nothing]

(*{{{7, 9}, {9, 2}}, {{6, 7}}, {{6, 7}}, {{2, 11}}, {{7, 8}}, {{11, 1}}, {{1, 5}, {5, 7}}, 
{{7, 8}}, {{11, 1}}, {{8, 6}}, {{2, 11}}, {{8, 6}}}*)

Using Delete and Position to delete cases from newD:

l1 = listF;
l2 = newD;

Delete[l2, Position[l2, Alternatives @@ Join[#, Reverse /@ #] &@l1]]

(*{{{7, 9}, {9, 2}}, {{6, 7}}, {{6, 7}}, {{2, 11}}, {{7, 8}}, {{11, 1}}, {{1, 5}, {5, 7}}, 
{{7, 8}}, {{11, 1}}, {{8, 6}}, {{2, 11}}, {{8, 6}}}*)
Post Deleted by E. Chan-López
Source Link
E. Chan-López
  • 31.2k
  • 3
  • 29
  • 50

Using ReplacePart:

l1 = listF;
l2 = newD;
ReplacePart[l2, Catenate[Position[l2, #] & /@ (Join[#, Reverse /@ #] &@l1)] -> Nothing]

(*{{{7, 9}, {9, 2}}, {{6, 7}}, {{6, 7}}, {{2, 11}}, {{7, 8}}, {{11, 1}}, {{1, 5}, {5, 7}}, 
{{7, 8}}, {{11, 1}}, {{8, 6}}, {{2, 11}}, {{8, 6}}}*)