remove duplicated lists inside list in lisp
common-lisp, lisp
Solution
Use the keyword argument `:test` to specify the function that defines whether or not two items are duplicates of each other. Most lisp functions, including `remove-duplicates`, use `eql` to test for equality by default. `eql` is much stricter than `equal`, which is what you probably want to be using.
(remove-duplicates '((1 2 3) (1 2 3)) :test #'equal)
This evaluates to `'((1 2 3))`.
See this post for more detail about the difference between `eql` and `equal`.
Problem
How do i remove duplicated lists inside a list in common-lisp? I tried this: ``` (remove-duplicates '( (1 2 3) (1 2 3))) ``` But it evaluates to `((1 2 3) (1 2 3))`, not `((1 2 3))`. Thanks.