This Text file is old! In a 🏛️Museum, an unsorted archive of (user-)pages. (Saved from Geocities in Oct-2009. The archival story: oocities.org)
--------------------------------------- (To 🚫report any bad content: archivehelp @ gmail.com)
>

; objpat2.scm - 

(define shish%
   (class object% () 
      (public 
         [name "shish"]
         [only-onions (void)]
         [is-vegetarian (void)])
      (sequence (super-init)) ))

(define skewer%
   (class shish% () 
      (public 
         [to-string 
          (lambda () 
            (string-append "new " name))] )
      (override
         [name "skewer"]
         [only-onions (lambda () #t)]
         [is-vegetarian (lambda () #t)])
      (sequence (super-init)) ))

(define onion%
   (class shish% (_s) 
      (public
         [s _s]
         [to-string 
          (lambda () 
            (string-append "new " name " (" (send s to-string) ")"))]
         )
      (override 
         [name "onion"]
         [only-onions (lambda () (send s only-onions))]
         [is-vegetarian (lambda () (send s is-vegetarian))])
      (sequence (super-init))    
))

(define lamb%
   (class shish% (_s) 
      (public
         [s _s]
         [to-string 
          (lambda () 
            (string-append "new " name " (" (send s to-string) ")"))]
         )
      (override 
         [name "lamb"]
         [only-onions (lambda () #f)]
         [is-vegetarian (lambda () #f)])
      (sequence (super-init))    
))

(define tomato%
   (class shish% (_s) 
      (public
         [s _s]
         [to-string 
          (lambda () 
            (string-append "new " name " (" (send s to-string) ")"))]
         )
      (override 
         [name "tomato"]
         [only-onions (lambda () #f)]
         [is-vegetarian (lambda () (send s is-vegetarian))])
      (sequence (super-init))    
))


;-------------------------------------------------------------------
(display "shish1")(newline)
(define shish-1 
  (make-object skewer%))
(send shish-1 to-string)
(send shish-1 only-onions)
(send shish-1 is-vegetarian)

(display "shish2")(newline)
(define shish-2 
  (make-object onion% 
    (make-object skewer%)))
(send shish-2 to-string)
(send shish-2 only-onions)
(send shish-2 is-vegetarian)

(display "shish-3")(newline)
(define shish-3 
  (make-object onion% 
    (make-object lamb%
      (make-object onion%
        (make-object skewer%)))))
(send shish-3 to-string)
(send shish-3 only-onions)
(send shish-3 is-vegetarian)

(display "shish-4")(newline)
(define shish-4 
  (make-object lamb% 
     (make-object skewer%)))
(send shish-4 to-string)
(send shish-4 only-onions)
(send shish-4 is-vegetarian)

(display "shish-5")(newline)
(define shish-5 
  (make-object onion% 
    (make-object onion%
      (make-object onion%
        (make-object skewer%)))))
(send shish-5 to-string)
(send shish-5 only-onions)
(send shish-5 is-vegetarian)

(display "shish-6")(newline)
(define shish-6 
  (make-object tomato% 
    (make-object onion%
      (make-object tomato%
        (make-object skewer%)))))
(send shish-6 to-string)
(send shish-6 only-onions)
(send shish-6 is-vegetarian)

Text file Source (historic): geocities.com/soho/square/3472

geocities.com/soho/square
geocities.com/soho

(to report bad content: archivehelp @ gmail)