Код Ревью

Сравни свои решения

    (define (count-pairs x)
  (define parsed-pairs '())

  (define (in-list pair list)
    (cond
      [(null? list) #f]
      [(eq? pair (car list)) #t]
      [else (in-list pair (cdr list))]))

  (define (add-pair! pair)
    (set! parsed-pairs (cons pair parsed-pairs)))

  (define (count x)
    (cond
      [(not (pair? x)) 0]
      [(in-list x parsed-pairs) 0]
      [else
       (begin
         (add-pair! x)
         (+ (count (car x)) (count (cdr x)) 1))]))

  (count x))