Managing state - chapter 3 of SICP
I've been working through in Structure and Interpretation of Computer Programs and completing the exercises in Haskell. The first two chapters were fine (code at github ) but Chapter 3 is making me think harder. It starts by talking about managing state, with the example of a bank account. They define a function make-withdraw by (define (make-withdraw balance) (lambda (amount) (if (>= balance amount) (begin (set! balance (- balance amount)) balance) "Insufficient funds"))) so that you can execute the following code: (define w1 (make-withdraw 100)) (define w2 (make-withdraw 100)) (w1 50) 50 (w2