Identifiers (Maxima 5.45.1 Manual)

Next: Inequality, Previous: Nouns and Verbs, Up: Expressions [Contents][Index]

### 6.3 Identifiers

Maxima identifiers may comprise alphabetic characters, plus the numerals 0 through 9, plus any special character preceded by the backslash `\` character.

A numeral may be the first character of an identifier if it is preceded by a backslash. Numerals which are the second or later characters need not be preceded by a backslash.

Characters may be declared alphabetic by the `declare` function. If so declared, they need not be preceded by a backslash in an identifier. The alphabetic characters are initially `A` through `Z`, `a` through `z`, `%`, and `_`.

Maxima is case-sensitive. The identifiers `foo`, `FOO`, and `Foo` are distinct. See Lisp and Maxima for more on this point.

A Maxima identifier is a Lisp symbol which begins with a dollar sign `$`. Any other Lisp symbol is preceded by a question mark `?` when it appears in Maxima. See Lisp and Maxima for more on this point.

Examples:

    (%i1) %an_ordinary_identifier42;
    (%o1)               %an_ordinary_identifier42

    (%i2) embedded\ spaces\ in\ an\ identifier;
    (%o2)           embedded spaces in an identifier

    (%i3) symbolp (%);
    (%o3)                         true

    (%i4) [foo+bar, foo\+bar];
    (%o4)                 [foo + bar, foo+bar]

    (%i5) [1729, \1729];
    (%o5)                     [1729, 1729]

    (%i6) [symbolp (foo\+bar), symbolp (\1729)];
    (%o6)                     [true, true]

    (%i7) [is (foo\+bar = foo+bar), is (\1729 = 1729)];
    (%o7)                    [false, false]

    (%i8) baz\~quux;
    (%o8)                       baz~quux

    (%i9) declare ("~", alphabetic);
    (%o9)                         done

    (%i10) baz~quux;
    (%o10)                      baz~quux

    (%i11) [is (foo = FOO), is (FOO = Foo), is (Foo = foo)];
    (%o11)                [false, false, false]

    (%i12) :lisp (defvar *my-lisp-variable* '$foo)
    *MY-LISP-VARIABLE*

    (%i12) ?\*my\-lisp\-variable\*;
    (%o12)                         foo

Categories: Syntax

Next: Inequality, Previous: Nouns and Verbs, Up: Expressions [Contents][Index]