問題3.4

(define (call-the-cops)
  (print "通報しますた!"))

(define (make-account balance password)
  (let ((pwmiss 0))
    (define (withdraw amount)
      (if (>= balance amount)
          (begin (set! balance (- balance amount))
                 balance)
          "Insufficient funds"))
    (define (deposit amount)
      (set! balance (+ balance amount))
      balance)
    (define (dispatch pw m)
      (if (eq? pw password)
          (begin
            (set! pwmiss 0)
            (cond ((eq? m 'withdraw) withdraw)
                  ((eq? m 'deposit) deposit)
                  (else (error "Unknown request -- MAKE-ACCOUNT" m))))
          (begin
            (set! pwmiss (+ pwmiss 1))
            (when (> pwmiss 6) (call-the-cops))
            (error "Incorrect password"))))
    dispatch))