SICP Exercise 3.4 call-the-cops

Exercise 3.4.  Modify the make-account procedure of exercise 3.3 by adding another local state variable so that, if an account is accessed more than seven consecutive times with an incorrect password, it invokes the procedure call-the-cops.

SOLUTION

I converted the explicit 'dispatch' procedure into a lambda function. This made it more elegant.

The code is here:

SICP Exercise 3.4 call-the-cops

Comments

Popular posts from this blog

SICP Exercise 4.18 a alternative strategy for interpreting internal definitions

SICP Exercise 3.11 make-account internal definitions with local state

SICP Exercise 3.13 make-cycle