Recursive Functions of Lists
> (define (censor lst)
; Returns LST with no instances of BAD.
(cond ((null? lst) ())
((eq? (car lst) 'BAD)
(censor (cdr lst)) )
(#t (cons (car lst)
(censor (cdr lst)) ) ) ) )
CENSOR
> (censor '(This is a bad bad list))
(THIS IS A LIST)
Previous slide
Next slide
Back to first slide
View graphic version