'Why is common lisp's `set-difference` not working? [duplicate]

So, I am trying to use set-difference in Common Lisp (sbcl) and it doesn't really work on lists of structures.

For example,

* varr ;; =>
(#S(VAR :V S) #:$K520)

* pm ;; =>
(#S(VAR :V +) #S(VAR :V S) #S(VAR :V Y) #S(VAR :V X) #:$K520)

* (set-difference pm varr) ;; =>
(#S(VAR :V X) #S(VAR :V Y) #S(VAR :V S) #S(VAR :V +))

The answer should be:

(#S(VAR :V X) #S(VAR :V Y) #S(VAR :V +))

How can I fix this?

Thanks!



Solution 1:[1]

To make it work this is how to do it:

(set-difference pm varr :test #'equalp)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 sphereInAManifold