The UEX Function: Expunge
The OEX function erases global objects or active local objects specified by the
argument from the active workspace (unless the object is a pendent or suspended
function). This function is monadic (takes one argument); the argument must be
a scalar, vector, or matrix of characters.
Thus, if object AB is to be erased, the following instruction would be entered:
Note: Even after the object is erased, the name remains in the symbol table (the
part of the active workspace that contains all of the symbols used).
The OEX function returns an explicit result of 1 if the object is erased and a 0
if it is not erased or if the argument does not represent a valid name. When the
UEX function is applied to a matrix of names (each row represents a name), the
result is a logical vector (zeros and/or ones) with an element for each name. The
UEX function is like the )ERASE command, except that it applies to the active
referent (see Chapter 6, Local and Global Names) of a name.
Note: If the object being expunged is a shared variable (see Chapter 81, it will
be retracted.
The UNL Function: Name List
The UNL function yields a character matrix; each row of the matrix represents
the name of a local (active referent) or global object in the active workspace.
The ordering of the rows has no special significance. The ONL function can be
either monadic (takes one argument) or dyadic (takes two arguments); in both the
monadic and dyadic forms, the right argument is an integer, scalar, or vector that
determines the class(es) of names that will be
included in the result. The values
for the input argument and associated classes of names are:
Argument Name Class
1 Names of labels
2 Names of variables
3 Names of user-defined functions
It does not make any difference in what order the class of names appears in the
argument. For example, ONL 2 3 or ONL 3 2 results in a matrix of all the vari-
able and user-defined function names.
In the dyadic form, the left argument is a scalar or vector of alphabetic charac-
ters that restricts the names produced to those with the same initial character
as that of the argument. For example, 'AD' UNL 2 results in a matrix of all
the variable names starting with the character A or D.
3'
132
I
I
I I
--
I I
Uses of the ONL function include:
I
0 Erasing objects of a certain class (and also beginning with a certain character).
For example:
[]EX ' H ' CINI.., 2
erases all the variables whose names start with B.
0 Avoiding the choice of a name that already exists.
The 0 NC Function: Name Classification
The ONC function is monadic (takes one argument); the argument is a scalar or
array of characters. The result of the function is a vector of numbers represent-
ing the class of the name given in each row of the argument. The classes of names
are as follows:
Result Meaning
0
1 Name of a label
2 Name of a variable
3 Name of a function
4
Name is available for use
Name is nonstandard (not available for use)
133
Previous Page Next Page