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

Class `library' part 1


(define make-library
  (lambda(aname)
    (define name aname)
    (define books nil)
    (define readers nil)
    (define base-object (make-base-object))
;
    (define search-book-aux
      (lambda(pred anauthor atitle l)
        (if (nullp l)
            false
            (if (pred anauthor atitle (car l))
                (car l)
                (search-book-aux pred anauthor atitle (cdr l))))))
;
    (define search-book
      (lambda(anauthor atitle)
        (search-book-aux
          (lambda(author title x)
            (if (and (equal author ((x 'get-author)))
                     (equal title  ((x 'get-title))))
                true
                false))
          anauthor atitle books)))
;
    (define get-books
      (lambda()
        books))
;
    (define get-readers
      (lambda()
        readers))
;



Georg P. Loczewski 2004-03-05


Impressum und Datenschutz