Could someone tell me what potential problems we would get from changing these two first functions dedicated to removing duplicates from a list to the last two that are for streams
(define (memq item x)
(cond ((null? x ) #f)
((eq? item (car x )) x)
(else (mem item (cdr x)))))
(define (r lst)
(cond ((null? lst) '())
((not (memq (car lst ) (scdr lst)))
(cons(car lst) (r (cdr lst))))
(else (r ( cdr last)))))
Under we have the stream version, all I have done here as you can see is changing car,cons and cdr to stream versions. I read that this will have potential problems but I cannot see why.
(define (memq item x)
(cond ((null? x ) #f)
((eq? item (stream-car x )) x)
(else (memq item (stream-cdr x)))))
(define (r lst)
(cond ((null? lst) '())
((not (memq (stream-car lst ) (stream-cdr lst)))
(cons-stream (stream-car lst) (r (stream-cdr lst))))
(else (r ( stream-cdr lst)))))