Important! These are all exam-level problems. Do not attempt these problems without a solid foundation in the subject and use them for exam practice.
1. Implement remove, which takes in a scheme list and outputs a new one without any instances of the passed in element.
(define (remove lst elm))
(cond
((null? item) nil)
((= (car lst) item) (remove (cdr lst) item))
(else (cons (car lst) (remove (cdr lst) item)))))
(define (remove lst elm))
"YOUR CODE HERE"
2. Implement the above function, remove, tail recurisvely. Assume now, however, that the item is only present in the list at most once.
(define (remove-tail lst item)
(define (remove-help lst so-far)
(cond ((null? lst) so-far)
((eq? (car lst) item) (append so-far (cdr lst)))
(else (remove-help (cdr lst)
(append so-far (list (car lst)))))))
(remove-help lst)
(define (remove-tail lst item)
"YOUR CODE HERE"