alternative coops define-class added by DerGuteMoritz on Fri Aug 24 17:56:36 2012

(define-class* <account> () self
  ((balance 0) (transactions '()))

  ((account-balance)
   (balance self))

  ((transact! amount)
   (set! (transactions self) (alist-cons (current-seconds) amount (transactions self)))
   (set! (balance self) (+ (balance self) amount)))

  ((credit! amount)
   (transact! self amount))

  ((debit! amount)
   (transact! self (- amount))))


(define acc (make <account>))

(test 0 (account-balance acc))
(credit! acc 100)
(debit! acc 20)
(test 80 (account-balance acc))