title: Finding all supersets in a list of sets
body: <p>The following function aims to return all of the supersets in a list of sets--ie, remove any set that is a subset of any other set in the list. So (supersets '((1 2) (1 2 3) (3 2) (3 5) (5 3))) -> ((1 2 3) (3 5)). Is there a more elegant/efficient way to think about how to do this? It would seem to roughly fit the common-lisp "reduce" model, except that two non-overlapping sets simply reduce to themselves. Thanks for any simplifications or insights:</p>
  
  <pre><code>(defun supersets (sets)
    (let ((remaining-sets sets))
      (loop for set1 in sets
        do (loop for set2 in (set-difference remaining-sets (list set1))
             when (subsetp set1 set2)
              do (setq remaining-sets
                       (set-difference remaining-sets (list set1)))
                 (return))
        finally (return remaining-sets))))
  </code></pre>