Practice
(define (make-account balance password)
(define (withdraw amount)
(if (>= balance amount)
(begin (set! balance (- balance amount))
balance)
"Insufficient funds"))
(define (deposit amount)
(set! balance (+ balance amount)))
(define (dispatch m)
(cond ((eq? m 'withdraw) withdraw)
((eq? m 'deposit) deposit)
(else (error "Unknow request -- MAKE-ACCOUNT"
m))))
(define (validate p op)
(if (eq? password p)
(dispatch op)
(error "error password")))
validate)
(define acc (make-account 100 'psw))