The function remove-duplicates in lisp only works for simple lists like (a b c d).
My question is that how I can remove duplicate elements from a list with nested lists inside it. So for example
I have a list with nested lists as follows: ( (0 1) (0 2) (0 1) (0 3) )
and I want to remove one of the (0 1) lists which is repeated twice inside the list above to get:
( (0 1) (0 2) (0 3) )
Give
:test #'equaltoremove-duplicates, and it will do what you want.As we see in CLHS: Satisfying a Two-Argument Test,
:testdefaults to#'eqlwhen not given, and two lists like(0 1)are noteqlunless they are the same list (eq).