next up previous contents index
Next: Library test part 1 Up: 3rd example of object Previous: Class `library' part 2   Contents   Start

Class `library' part 3


    (define show-books
      (lambda()
        (for-each (lambda(x) ((x 'display))) books)))
;
    (define show-readers
      (lambda()
        (for-each (lambda(x) 
                    ((x 'who-are-you))) readers)))
;
    (define who-are-you
      (lambda()
        (print name)))
;
    (define self
      (lambda(msg)
        (if (equal msg 'get-books)
            get-books
            (if (equal msg 'get-readers)
                get-readers
                (if (equal msg 'new-book)
                    new-book
                    (if (equal msg 'sell-book)
                        sell-book
                        (if (equal msg 'lend-book)
                            lend-book
                            (if (equal msg 'take-back-book)
                                take-back-book
                                (if (equal msg 'show-books)
                                    show-books
                                    (if (equal msg 'show-readers)
                                        show-readers
                                        (if (equal msg 'who-are-you)
                                            who-are-you
                                            (base-object msg))))))))))))
     self))



Georg P. Loczewski 2004-03-05


Impressum und Datenschutz