Given the below code, write delete! (at the end) which takes a key and a table as its inputs and deletes the key-value pair from the table if the key is found.
Hint: Draw a picture of a table and think about what the table would look like after the deletion.
(define (make-table)
(cons '* '()))
(define (empty-table? t) (null? (cdr t)))
(define (insert! key value table)
(let ((record (assoc key (cdr table))))
(if record
(set-cdr! record value)
(set-cdr! table
(cons (cons key value) (cdr table)))))
'ok)
(define (lookup k t)
(let ((record (assoc k (cdr t))))
(cond (record (cdr record))
(else #f))))
(define (assoc key records)
(cond ((null? records) #f)
((equal? key (caar records)) (car records))
(else (assoc key (cdr records)))))
(define (rlookup k t)
(let ((record (rassoc k (cdr t))))
(cond (record (car record))
(else #f))))
(define (rassoc value records)
(cond ((null? records) #f)
((equal? value (cdar records)) (car records))
(else (rassoc value (cdr records)))))
(define (delete! k t)
???)