title: How to tell if two sets are equal in content (disregarding order) in racket?
body: <p>I have a homework problem that is asking me to tell if two sets are equal in content, regardless of order. </p>
  
  <p>Ex: <code>(set-equal? (list 1 2 3) (list 3 2 1))</code> is true</p>
  
  <p>I have gotten this code so far,</p>
  
  <pre><code>(define (set-equal? list1 list2)
    (cond
      [(and (empty? list1) (empty? list2)) true]
      [(and (cons? list1) (empty? list2)) false]
      [(and (empty? list1) (cons? list2)) false]
      [(and (cons? list1) (cons? list2))
        (if (member? (first list1) list2) 
            (set-equal? (rest list1) list2)
            (set-equal? (rest list1) list2))]))
  </code></pre>
  
  <p>This code obviously doesn't work because even if two lists are equal, the recursion will lead to (empty) for list 1 and list 2 will still have data, making the final output false.</p>
  
  <p>I think I should approach this way:
  Check the data in list1 against data in list2 and if there are equal data, remove it from both lists. Then keep checking until either both lists are empty (giving true) or one is empty and one still has data (outputting false). The problem is, I don't know how to code this.</p>
  
  <p>Can anyone give me a little hint on how to fix this problem?</p>