;;; class definition
(defclass account () ((balance :initform 0))) ;;; method definition (defmethod account deposit (amount) (setf balance (+ balance amount)) balance) ;;; object creation and method invocation (let ((acc (make-account :balance 100))) (print "Current balance: " (deposit acc 50))) ;;; use of the future and touch (let ((acc (make-account :balance 100))) (let ((rbox (future (deposit acc 30)))) (some computation) (print "Current balance: " (touch rbox)))) |