Parameterized Programs

A highly parameterized program is easier to write and maintain than many specialized versions for different applications, but may be inefficient.

Example: Draw a line: (x1, y1) to (x2, y2).
Options include:

If all of these options are expressed as parameters, it makes code longer, makes calling sequences longer, and requires interpretation at runtime. Partial evaluation can produce efficient specialized versions automatically.

(draw-line x y (+ x 100) y 1 'black 'solid)

Contents    Page-10    Prev    Next    Page+10    Index