title: What is wrong with my scheme code?
body: <p>The function I wrote for SICP 2.20 is:</p>
  
  <pre><code>(define (same-parity x . y)
    (if (null? (car y)
    '()
    (if (= (even? (car y)) (even? x))
       (cons (car y) (same-parity (cons x (cdr y))))
       (same-parity (cons x (cdr y))))))
  </code></pre>
  
  <p>And then I try to call it with </p>
  
  <pre><code>(same-parity 1 2 3 4 5 6 7)
  </code></pre>
  
  <p>The error I get is:
  "The object #t, passed as the first argument to integer-equal? is not the correct type."</p>
  
  <p>I thought that equal works with #t and #f...</p>
  
  <p>An example of code I found online is the following, I ran it and it works.  But, what am I doing wrong?</p>
  
  <pre><code>(define (same-parity a . rest)
    (define (filter rest)
      (cond ((null? rest) '())
            ((= (remainder a 2) (remainder (car rest) 2))
             (cons (car rest) (filter (cdr rest))))
            (else
              (filter (cdr rest)))))
    (filter (cons a rest)))
  </code></pre>