(define (count-pairs x)
  (if (not (pair? x))
      0
      (+ (count-pairs (car x))
         (count-pairs (cdr x))
         1)))
(define 3-ring '(1 2 3))
(define 4-ring
  (let ((last-cel (cons 'lastcar 'lastcdr)))
    (cons last-cel (cons last-cel '()))))
(define 7-ring
  (let* ((third (list 3))
         (second (cons third third)))
    (cons second second)))
(define infinite-ring
  (let* ((third (list 3))
         (first (list 1 third)))
    (set-cdr! third first)))