I have this iterative process in Scheme. (In fact I don't really know what kind of process it really is)
(define (contains-double? lst)
(cond
((or (null? lst) (null? (cdr lst))) #f)
((eq? (car lst) (cadr lst)) #t)
(else (contains-double? (cdr lst)))))
It checks If there are 2 of the same numbers next to each other. For example:
(contains-double? '(1 2 3 3 3 5 2)) => #t
(contains-double? '(1 2 3 5 3 2)) => #f
(contains-double? '(1 2 3 2 2)) => #t
Can I make this process recursive?
Thanks in advance