REDUCE

2.3 Identifiers

Identifiers in REDUCE consist of one or more alphanumeric characters (i.e. alphabetic letters or decimal digits) the first of which must be alphabetic. The maximum number of characters allowed is implementation dependent, although twenty-four is permitted in most implementations. In addition, the underscore character (_) is considered a letter if it is within an identifier. For example,

        a az p1 q23p  a_very_long_variable

are all identifiers, whereas

        _a

is not.

A sequence of alphanumeric characters in which the first is a digit is interpreted as a product. For example, 2ab3c is interpreted as 2*ab3c. There is one exception to this: If the first letter after a digit is E, the system will try to interpret that part of the sequence as a real number, which may fail in some cases. For example, 2E12 is the real number \(2.0*10^{12}\) and 2e3c is 2000.0*C. If the E is not followed by a number, 0 is assumed as the decimal exponent, thus 2e is interpreted as 2 and 2ebc as 2*bc.

Special characters, such as -, *, and blank, may be used in identifiers too, even as the first character, but each must be preceded by an exclamation mark in input. For example:

        light!-years    d!*!*n         good! morning
        !$sign          !5goldrings

CAUTION: Many system identifiers have such special characters in their names (especially * and =). If the user accidentally picks the name of one of them for his own purposes it may have catastrophic consequences for his REDUCE run. Users are therefore advised to avoid such names.

Identifiers are used as variables, labels and to name arrays, operators and procedures.

In graphical environments with typeset mathematics enabled, the (shared) variable fancy_lower_digits can be set to one of the values t, nil or all to control the display of digits within identifiers. The default value is t. Digits in an identifier are typeset as subscripts if fancy_lower_digits = all or if fancy_lower_digits = t and the digits are all at the end of the identifier. For example, with the following values assigned to fancy_lower_digits, the identifiers ab12cd34 and abcd34 are displayed as follows:

fancy_lower_digits ab12cd34 abcd34
t \(ab12cd34\) \(abcd_{34}\)
all \(ab_{12}cd_{34}\) \(abcd_{34}\)
nil \(ab12cd34\) \(abcd34\)

Restrictions

The reserved words listed in appendix 24 may not be used as identifiers. No spaces may appear within an identifier, and an identifier may not extend over a line of text.


Hosted by Download REDUCE Powered by MathJax