lisp - Delete all Occurences -
delete occurrences problem 5 (0 / 32)
define function deleteall has 2 input argument x , l, x atom , l list contains atomic elements , sublists level, , function returns list occurrences of x deleted list l.
i have problem when list has sublists. cant go recursively in sublists check whether has contains duplicate or not.
(defun deleteall (x l) (cond ((null l) nil) ((not(atom(car l))) (deleteall x (cdr l))) ((not(eq x (car l))) (cons (car l) (deleteall x (cdr l )))) (t(deleteall x (cdr l)))))
in second term know predicate got list in first element. should same third consequent except need process car
cdr
.
Comments
Post a Comment