#!/usr/local/bin/sbcl --script (defun eq-cl (lisst) (cond ( (null lisst) lisst) ( (null (intersection (car lisst) (reduce #'append (cdr lisst)))) (cons (remove-duplicates(car lisst)) (eq-cl (cdr lisst)) ) ) ( t (eq-cl (cons (reduce #'append (remove (car lisst) lisst :test-not #'intersection)) (remove (car lisst) (cdr lisst) :test #'intersection))) ) ) ) (eq-cl '((a b) (a) (b)))