I'm trying to delete an occurrence of some value in a binary search tree. This is what I have so far:
(define removeBin (lambda (x t)
(cond ((< x (car t)) (removeBin x (cadr t)))
((> x (car t)) (removeBin x (caddr t)))
((equal? x (car t))
(if(and (null? (cadr t)) (null? (caddr t))) '()
(let ((r (replacement t))) ((set! (car t) r) (removeBin r t))))))))
It's giving me the following error: set!: not an identifier in: (car t) What does that mean? and how can I fix it so that set! would work?
thank you