Search                        Top                                  Index
HELP NEWPR                                        J L Cunningham, Feb 82

    lib newpr;

NEWPR is a library procedure which can be used to alter the way
specified items are printed (but see also HELP *CLASSES). It is used as
follows:

    newpr(<type_recogniser>,<print_procedure>);

<type_recogniser> is a procedure of one argument that should return
FALSE if its argument is not one of the items which are to be printed
specially. <print_procedure> is a procedure of one argument that prints
the special item. For example:

    define silly(item);
        islist(item) and length(item) = 3
    enddefine;

    define prsilly(list);
        syspr(rev(list));
    enddefine;

    newpr(silly,prsilly);

    [a b c d] =>
    ** [a b c d]

    [c a t] =>
    ** [t a c]

Everything works as before, except that three element lists are printed
backwards. Notice that it was necessary to call *SYSPR, rather than *PR,
inside PRSILLY, otherwise we would get an infinite recursion.

See also

HELP *PRINT - for other printing procedures
REF  *SYSIO - for more details of I/O procedures


--- C.all/help/newpr
--- Copyright University of Sussex 1992. All rights reserved. ----------