Welcome to W3Courses
 Like Us on Facebook

Delete all Occurrences of an Element from a List Using Scheme Source Code

The following code deletes all occurrences of an element from a list

CODE
 (define deleteall( lambda (x y)
      (if (null? y )
            ()
      (if (eqv? (car y) x)
           (deleteall x (cdr y))
      (cons (car y) (deleteall x (cdr y)))))))

Share