title: Removing all duplicate members from a list in scheme
body: <p>I am trying to remove duplicates in a list, using recursion. This is what I have. It only removes the first duplicate, not all of them.</p>
  
  <p>My idea is to look at the first member, check if its a member of the rest of the list, if so, call the function again. If not, create a list with the first member and the result from calling the function again. I don't understand why it doesn't  remove all the duplicates. </p>
  
  <pre><code>(define (removeDupes L)
    (cond ((null? L) ())
          ((list? (member (car L) (cdr L))) removeDupes (cdr L))
          (#T (cons ((car L) (removeDupes (cdr L)))))))
  </code></pre>
  
  <p>This is what I modified it to, and it works!! And I understand what was wrong with the cons. It needs two parameters and I only gave it one. I still have no Idea why the third line did not work....</p>
  
  <pre><code>(define (removeDupes L)
    (cond ((null? L) ())
          ((list? (member (car L) (cdr L)))(removeDupes(cdr L)))
          (#T (cons (car L) (removeDupes (cdr L))))))
  </code></pre>