I have the following code and would like to add a 'clear message that removes all the stored numbers from the internal list. How would I do this?
(define (make-stat)
(let ((values (list)))
(lambda (op . args)
(cond ((eq? op 'add)
(set! values (cons (car args) values)))
((eq? op 'mean)
(if (null? values)
(error "can't take mean of empty data set")
(mean values)))
((eq? op 'variance)
(if (null? values)
(error "can't take variance of empty data set")
(variance values)))
(else (error "unknown op" op))))))