(define (make-account balance passwd) (define (withdraw amount) (if (>= balance amount) (set! balance (- balance amount)) "insufficient funds")) (define (deposit amount) (set! balance (+ balance amount))) (define (status) balance) (define (foreign-deposit amount value) (set! balance (+ balance (* amount value)))) (define incorrect (lambda x "incorrect password")) (define (dispatch pass m) (cond ((not (eq? pass passwd)) incorrect) ((eq? m 'withdraw) withdraw) ((eq? m 'deposit) deposit) ((eq? m 'status) status) ((eq? m 'foreign-deposit) foreign-deposit) (else (error "Unkown request --MAKE-ACCOUNT" m)))) dispatch)