Representation Independence

In order to use a library program, it is usually necessary to understand the parameters it requires and to write code to compute these from the application data.

Example: Draw an object. It is desirable to be able to say simply (draw item place ) .


(stsz (list (start vector) (size vector)))
(mkv 'line-segment 'stsz)

(glinstfnpattern 'draw '((s stsz) (myw window)))

(gldefun t21 ((s stsz) (myw window))
  (DRAW-LINE-XY MYW (P1X (LINE-SEGMENT S))
                    (P1Y (LINE-SEGMENT S))
                    (P2X (LINE-SEGMENT S))
                    (P2Y (LINE-SEGMENT S))))
(LAMBDA (S MYW)
  (LET ((QQWHEIGHT (CADDDR MYW)))
    (XDRAWLINE *WINDOW-DISPLAY* (CADR MYW)
        (CADDR MYW) (CAAR S)
        (- QQWHEIGHT (CADAR S))
        (+ (CAADR S) (CAAR S))
        (- QQWHEIGHT (+ (CADADR S) (CADAR S))))
    NIL))

Contents    Page-10    Prev    Next    Page+10    Index