Loglan 82, A micro-manual of the programming language - Basic constructs and facilities

9) Formal types


Formal types serve for unit parametrization with respect to any non-primitive type.

Example:

Procedure Gsort (the generalization of procedure sort from p.4) has type parameter T. A corresponding actual parameter may be an arbitrary non-primitive type. An actual parameter corresponding to A should be an array of elements of the actual type T. Function less should define the linear ordering on the domain T.

For instance, the array A of type bill (cf p.7) may be sorted with respect to attribute dollars , if the function:

is used as an actual parameter:

If the user desires to sort A with respect to date, it is sufficient to declare :

and to call: call Gsort(bill,A,earlier);




Last update 02/07/95
Comments, suggestions and critiques are welcome to : linfo062@crisv2.univ-pau.fr