@ -28,6 +28,16 @@
1))))
(count l '()))
(define (has-cycle? l)
(define (cycle-iter l seen-pairs)
(cond ((not (pair? l)) #f)
((memq (cdr l) seen-pairs) #t)
(else
(cycle-iter (cdr l)
(cons l seen-pairs)))))
(cycle-iter l '()))
;; Both give 3
(define l1 '(a b c))