Back to slide -- Keyboard shortcut: 'u'        next -- Keyboard shortcut: 'n'          point-all.scm - The definition of a 'class Point ' with methods getx , gety , add , and type-of.Lecture 3 - slide 3 : 43
Program 1

(define (point x y)
  (letrec ((getx    (lambda () x))
           (gety    (lambda () y))
           (add     (lambda (p) 
                      (point 
                       (+ x (send 'getx p))
                       (+ y (send 'gety p)))))
           (type-of (lambda () 'point))
          )
    (lambda (message)
      (cond ((eq? message 'getx) getx)
            ((eq? message 'gety) gety)
            ((eq? message 'add)  add)
            ((eq? message 'type-of) type-of)
            (else (error "Message not understood"))))))