3 ;; Consider the problem of transferring an amount from one account to
4 ;; another. Ben Bitdiddle claims that this can be accomplished with the
5 ;; following procedure, even if there are multiple people concurrently
6 ;; transferring money among multiple accounts, using any account
7 ;; mechanism that serializes deposit and withdrawal transactions, for
8 ;; example, the version of make-account in the text above.
10 (define (transfer from-account to-account amount)
11 ((from-account 'withdraw) amount)
12 ((to-account 'deposit) amount))
16 Since withdraw and deposit themselves are 'atomic' (or rather 'safe')
17 there is no problem with this routine.