next up previous contents
Next: Test output part 1 Up: 2nd example of object Previous: Class `animal-shelter'   Contents


Test of `animal-shelter'


(define animal-shelter
  (lambda()
    (define shelter  (make-shelter))
    (define ls       nil)
    (print " ")
;
    (define bello    (make-dog "bello"))
    (define inka     (make-dog "inka"))
    (define muschi   (make-cat "muschi"))
    (define missi    (make-cat "missi"))
    (print " ")
;   
    ((bello  'who-are-you))
    ((muschi 'who-are-you))
    (print " ")
;
    ((shelter 'accept) bello)
    ((shelter 'accept) inka)
    ((shelter 'accept) muschi)
    ((shelter 'accept) missi)
    (print " ")
;                        
    (define found ((shelter 'find) "muschi"))
    (if (equal found false)
         (print "Muschi not found!")
         ((found 'who-are-you)))
    (print " ")
;
    (print "begin of shelter")
    ((shelter 'display))
    (print "end of shelter")
    (print " ")
;
    ((shelter 'dismiss) missi)
    ((shelter 'dismiss) bello)
    (print " ")
;
    (print "begin of shelter")
    ((shelter 'display))
    (print "end of shelter")
    (print " ")
;
    (define found ((shelter 'find) "inka"))
    (if (equal found false)
        (print "Inka not found!")
        ((found 'who-are-you)))
    (print " ")
;
    (define found ((shelter 'find) "missi"))
    (if (equal found false)
        (print "Missi not found!")
        ((found 'who-are-you)))
    (print " ")
;
    (print "begin of shelter")
    ((shelter 'display))
    (print "end of shelter")
    (print " ")
;
    ((muschi 'who-are-you))
    ((shelter 'accept) muschi)
    (print " ")
;
    (print "begin of shelter")
    ((shelter 'display))
    (print "end of shelter")
    ))



Georg P. Loczewski 2004-03-05


Impressum und Datenschutz