REDUCE

1.3 Hints on Using the PSL System

The following sub-sections collect a few miscellaneous notes that are further expanded on elsewhere. They are provided here simply to get you started.

1.3.1 Loading Optional Modules

Certain modules are not present in the ”kernel” or ”bare-psl” system, but can be loaded as options. Some of these optional modules will be automatically loaded when first referenced. Other modules may be explicitly loaded by the user, or included by the installer when building the PSL core image. Optional modules can be loaded by executing the following.

(load modulename)

When a module is loaded its name is added to a list referenced by the global variable options*. The modules which make up the BARE-PSL kernel are not included in this list. An application of load will be aborted if the argument is found in the options* list. If it is necessary to load a module a second time use reload, do not attempt to alter the value of options*.

1.3.2 Error and Warning Messages

Many functions detect and signal appropriate errors ; in many cases, an error message is printed. The error conditions are given as part of a function’s definition in the manual. An error message is preceded by five stars (*); a warning message is preceded by three. For example, most primitive functions check the type of their arguments and display an error message if an argument is incorrect. The type mismatch error mentions the function in which the error was detected, gives the expected type, and prints the actual value passed.

1 lisp> (car "STR")  
⋆⋆⋆⋆⋆ An attempt was made to do CAR on ‘"STR"', which is not a pair

The switch usermode is used to distinguish between functions which comprise PSL and functions defined by the user. When the value of this switch is t then the name of each user defined function is flagged user. When a function is about to be defined, if *usermode is t, there is another function associated with the name, and the name is not flagged lose then the following prompt will be displayed.

Do you really want to redefine the system function ‘NAME'?

You are expected to respond with YES, Y, NO, N, or B. A response of B will result in a break loop (see Chapter 16). After quitting the break loop you should respond with YES, Y, NO, or N (see yesp in Chapter 15). Unless you consider yourself an expert it is dangerous to give an affirmative response. It is best to simply give your function a different name. If the switch redefmsg is set to t then whenever a function is redefined the message

⋆⋆⋆ Function ‘NAME' has been redefined

will be printed.

If an identifier is flagged LOSE then it cannot be assigned a functional definition.

⋆⋆⋆ ‘NAME' has not been defined, because it is flagged LOSE