(define make-author (lambda(aname) (define books nil) (define super (make-person aname)) ; (define new-book (lambda(atitle library) (define nbook (make-book atitle self)) (define books (cons nbook books)) ((library 'new-book) nbook) nbook)) ; (define show-books (lambda() (for-each (lambda(x) ((x 'display))) books))) ; (define who-are-you (lambda() (print (super 'get-name)))) ; (define self (lambda(msg) (if (equal msg 'new-book) new-book (if (equal msg 'show-books) show-books (if (equal msg 'who-are-you) who-are-you (super msg)))))) self)) |
Georg P. Loczewski 2004-03-05