Stoffel

Oplossing

Jan 16th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 0.27 KB | None | 0 0
  1. (define (make-withdraw initial-amount)
  2.   (let ((balance initial-amount))
  3.     (lambda (amount)
  4.       (if (>= balance amount)
  5.           (begin (set! balance (- balance amount)) balance)
  6.           "Insufficient funds"))))
  7.  
  8. (define wd (make-withdraw 100))
  9. (wd 10)
  10. (wd 10)
  11. (wd 90)
Advertisement
Add Comment
Please, Sign In to add comment