Specializing Generic Procedures


The Automatic Programming Server produces versions of generic procedures that are specialized for your data structures. Views describe how your data structures correspond to the abstract data types used in the generic procedures.

Before making specialized procedures, you must:

Then click the Make Programs command. The system may ask which user data type and which view to use. Then it will present a menu of the available programs to allow you to choose the program you want.

The program is specialized for your data structure and view; the result is printed in the window. The window may be too small to contain all of the code, but the full version of the code is included at the bottom of the page so you can get it at the end of the session.

You can obtain several specialized programs if you wish. One viewing allows specialization of any of the library of procedures associated with the abstract type.


Data Conversion

Programs can be generated that convert from one type of data to another based upon a shared view. For example, given an x-y vector and an r-theta vector, you can view each of them as the abstract type vector; then either can be converted to the other.

To generate a conversion program, first define the two data types and make a mathematical view of each of them. Then select the Convert Data command. The system will prompt you for the source type, and possibly for other selections. The result is a program that has an instance of the source type as its argument and produces a new instance of the goal type as its result.