REDUCE

4.5 System Global Variables, Switches and Other ”Hooks”

4.5.1 Introduction

A number of global variables provide global control of the PSL system, or reference values which are constant throughout execution. Certain options are controlled by switches, variables which have a value of either t or nil. For example, the value of *verboseload controls the display of messages when files are loaded. The values of other global variables are not restricted to be boolean. For example, the value of outputbase* is the radix in which numbers are printed. PSL uses the convention that the name of a global variables which is a switch begins with ”*”. The names of other global variables end with ”*”.

4.5.2 Setting Switches

Strictly speaking, NAME is a switch and *NAME is a corresponding global variable that assumes a value of t or nil. Both NAME and *NAME are loosely referred to as switches elsewhere in the manual.

The functions on and off functions are used to change the values of the identifiers associated with switches. Some switches contain an s-expression on their property lists under the indicator simpfg 1 1The name simpfg comes from its introduction in the Reduce algebra system, where it was used to specify various simplifications to be performed as various switches were turned on or off.. The s-expression has the form of a cond list:

((t (action-for-on)) (nil (action-for-off)))

If the simpfg indicator is present, then the on and off functions also evaluate the appropriate action in the s-expression.

(on [U:id]): Undefined macro
For each switch U, the associated identifier *U is set to nil. If the clause (t (action-for-on) is found under the indicator simpfg on U then the expression action-for-on will be evaluated.

(off [U:id]): Undefined macro
For each switch U, the associated identifier *U is set to nil. If the clause (nil (action-for-off) is found under the indicator simpfg on U then the expression action-for-off will be evaluated.
The switch fast-integers is used by the compiler when arithmetic expressions are compiled. There are definitions of numeric operators which do not check the types of their arguments in order to reduce execution time. Evaluation of
(get 'fast-integers 'simpfg)

returns

((t (enable-fast-numeric-operators))  
 (nil (disable-fast-numeric-operators))))

Evaluation of (on fast-integers) will result in *fast-integers being set to t and evalution of the function enable-fast-numeric-operators.

4.5.3 Special Global Variables

nil = [Initially: nil] global
   
A special global variable whose value cannot be modified by set or setq.

t = [Initially: t] global
   
A special global variable whose value cannot be modified by set or setq.

4.5.4 Special Put Indicators

Some actions search the property list of relevant ids for the following indicators.

breakfunction

Associates a function to be run with an id typed in a break loop (see Chapter 16). For example, q is used to exit from a break loop and (get ’q ’breakfunction) returns breakquit.

type

PSL uses the property type to indicate whether a function is a fexpr, macro, or nexpr. If this property is absent, expr is assumed. For example, (get ’and ’type) returns fexpr.

vartype

PSL uses the property vartype to indicate whether an identifier is of type global or fluid.

         1 lisp > (fluid '(mary))  
         nil  
         2 lisp > (get 'mary 'vartype)  
         fluid

*lambdalink

The interpreter looks under *lambdalink for a lambda expression when a compiled definition cannot be found.

         1 lisp > (de list-first (p) (car p))  
         list-first  
         2 lisp > (get 'list-first '⋆lambdalink)  
         (lambda (p) (car p))

The compiler and loader use a number of other indicators, see Chapter 19.

4.5.5 Special Flag Indicators

eval, ignore

These flags are used primarily to control the evaluation of expressions during compilation (for more information see Chapter 19).

lose

The function putd is used to associate function definitions with ids. Its application is aborted if the id has been flagged lose.

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

user

If *usermode is t, when a function is defined its name will be flagged user. This is used to distinguish user defined functions from system functions (see Chapter 9 for more information).