Haskell, 33 bytes
nub.((\\)<*>nub)
import Data.List
Try it online! Port of my Husk answer.
Haskell, 50 bytes
([]#)
a#(x:r)=([x|any(==x)r,all(/=x)a]++a)#r
a#_=a
Try it online! Alternative without imports.
nub.((\\)<*>nub)
import Data.List
Try it online! Port of my Husk answer.
([]#)
a#(x:r)=([x|any(==x)r,all(/=x)a]++a)#r
a#_=a
Try it online! Alternative without imports.