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