Back to slide -- Keyboard shortcut: 'u'        next -- Keyboard shortcut: 'n'  Annotated program -- Keyboard shortcut: 't'    point-class-all.scm - All necessary stuff to play with Point.Lecture 8 - slide 7 : 11
Program 1

(define (new-instance class . parameters)
  (apply class parameters))

(define (send message object . args)
  (let ((method (object message)))
    (cond ((procedure? method) (apply method args))
          (else (error "Error in method lookup " method)))))

(define (point x y)
 (let ((x x) 
       (y y)
   (define (getx) x)

   (define (gety) y)

   (define (add p) 
     (+ x (send 'getx p))
     (+ y (send 'gety p))))

   (define (type-of) 'point)
   (define (self message)
     (cond ((eqv? message 'getx) getx)
           ((eqv? message 'gety) gety)
           ((eqv? message 'add)  add)
           ((eqv? message 'type-of) type-of)
	   (else (error "Undefined message" message))))