demo2 - (default-method (* message message)) (method (7)...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
(define-class (counter) (instance-vars (count 0)) (class-vars (total 0)) (method (next) (set! total (1+ total)) (set! count (1+ count)) (list count total))) (define-class (person name) (method (say stuff) stuff) (method (ask stuff) (ask self 'say (se '(would you please) stuff))) (method (greet) (ask self 'say (se '(hello my name is) name))) ) (define-class (pigger name) (parent (person name)) (method (pigl wd) (if (member? (first wd) '(a e i o u)) (word wd 'ay) (ask self 'pigl (word (bf wd) (first wd))) )) (method (say stuff) (if (not (pair? stuff)) (ask self 'pigl stuff) (map (lambda (w) (ask self 'pigl w)) stuff))) ) (define-class (squarer)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: (default-method (* message message)) (method (7) 'buzz) ) (define-class (counter) (instance-vars (count 0)) (class-vars (total 0) (counters '())) (initialize (set! counters (cons self counters))) (method (next) (set! total (1+ total)) (set! count (1+ count)) (list count total))) (define-class (pigger name) (parent (person name)) (method (pigl wd) (if (member? (first wd) '(a e i o u)) (word wd 'ay) (ask self 'pigl (word (bf wd) (first wd))) )) (method (say stuff) (if (not (pair? stuff)) (if (equal? stuff 'my) (usual 'say stuff) (ask self 'pigl stuff)) (map (lambda (w) (ask self 'say w)) stuff))) )...
View Full Document

This note was uploaded on 11/30/2010 for the course EECS 21281 taught by Professor Harvey during the Spring '10 term at University of California, Berkeley.

Ask a homework question - tutors are online