Skip to content

Instantly share code, notes, and snippets.

@AdamHeck
AdamHeck / 1-make-account.scm
Created July 31, 2011 03:09 — forked from diiq/1-make-account.scm
SICP make-account in Tainted Oyster
;; This is some code from chapter 3 of SICP. I chose it by going to
;; http://mitpress.mit.edu/sicp/code/index.html , clicking at random
;; and picking the first good, meaty function that caught my eye. It
;; is a demonstration of object orientation by way of functional
;; closures.
(define (make-account balance)
(define (withdraw amount)
(if (>= balance amount)
(begin (set! balance (- balance amount))