Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » Thing » Symbol
next | previous | forward | backward | up | index | toc

# Symbol -- the class of all symbols

## Description

Symbols are entered as an alphabetic character followed by a sequence of alphanumeric characters; case is significant. The single symbol character ' is regarded as alphabetic, so that symbols such as x' may be used.

Symbols are used as names for values to be preserved, as indeterminates in polynomial rings, and as keys in hash tables. They may have global scope, meaning they are visible from every line of code, or local scope, with visibility restricted to a single file or function body.

    i1 : x

    o1 = x

    o1 : Symbol

    i2 : ab12

    o2 = ab12

    o2 : Symbol

## See also

- := -- assignment of method or new local variable
- <- -- assignment with left side evaluated
- threadLocal -- create a symbol whose value in one thread is not shared with others

### Menu

- Keyword -- the class of all keywords
- `SymbolBody` -- see symbolBody -- symbol bodies
- symbol -- get a symbol
- global -- get a global symbol
- local -- get a local symbol
- getSymbol -- make a global user symbol from a string
- getGlobalSymbol -- create a global symbol in a global dictionary
- isGlobalSymbol -- whether a global symbol with a given name exists
- erase -- remove a global symbol
- protect -- protect a symbol
- value(Symbol) -- retrieve the value of a symbol
- findSynonyms(Symbol) -- find synonyms of symbols
- globalAssign -- global assignment, in function form
- globalAssignFunction -- the standard method for the global assignment hook
- GlobalAssignHook -- hook for assignment to global variables
- globalAssignment -- install standard global assignment method
- globalAssignmentHooks -- assignment hooks for global symbols
- globalReleaseFunction -- the standard method for the global variable release hook
- GlobalReleaseHook
- Symbol _ Thing = Thing -- assignment to an indexed variable
- Symbol .. Symbol -- sequences of consecutive symbols
- Symbol ..< Symbol -- sequences of consecutive symbols
- Symbol _ Thing -- index variable

## Types of symbol:

- Keyword -- the class of all keywords

## Functions and methods returning a symbol:

- global -- get a global symbol
- `Dictionary # String` -- see List # ZZ -- get value from list, hash table, database, dictionary, or string
- local -- get a local symbol
- symbol -- get a symbol
- threadLocal -- create a symbol whose value in one thread is not shared with others

## Methods that use a symbol:

- `Symbol ? IndexedVariable` -- see ? -- comparison operator
- ? Symbol -- view brief documentation of a symbol
- `about(Symbol)` -- see about -- search the documentation
- `addHook(Symbol,Function)` -- see addHook -- add a hook function to an object for later processing
- `autoload(Symbol,String)` -- see autoload -- arrange for a function to be loaded automatically
- `baseName(Symbol)` -- see baseName -- the base name of a generator
- `code(Symbol)` -- see code -- display source code
- `concatenate(Symbol)` -- see concatenate -- join strings
- `dictionary(Symbol)` -- see dictionary -- determine the dictionary to which a symbol belongs
- findSynonyms(Symbol) -- find synonyms of symbols
- `frames(Symbol)` -- see frames -- get the frames associated to a closure
- `help(Symbol)` -- see help -- view documentation nodes
- `hooks(Symbol)` -- see hooks -- list hooks attached to a key
- `installAssignmentMethod(Symbol,HashTable,Function)` -- see installing assignment methods -- install methods assignment to the value of an operator
- `installAssignmentMethod(Symbol,HashTable,HashTable,Function)` -- see installing assignment methods -- install methods assignment to the value of an operator
- `installAssignmentMethod(Symbol,HashTable,HashTable,Option)` -- see installing assignment methods -- install methods assignment to the value of an operator
- `installAssignmentMethod(Symbol,HashTable,Option)` -- see installing assignment methods -- install methods assignment to the value of an operator
- `localDictionaries(Symbol)` -- see localDictionaries -- get local dictionaries
- `locate(Symbol)` -- see locate -- locate source code
- `methods(Symbol)` -- see methods -- list methods
- `package(Symbol)` -- see package -- get containing package
- `File << Symbol` -- see printing to a file -- print to a file
- `runHooks(Symbol,Thing)` -- see runHooks -- run the hook functions stored in an object
- Symbol .. Symbol -- sequences of consecutive symbols
- Symbol ..< Symbol -- sequences of consecutive symbols
- Symbol _ Ring -- get a ring variable by name
- Symbol _ Thing -- index variable
- Symbol _ Thing = Thing -- assignment to an indexed variable
- value(Symbol) -- retrieve the value of a symbol

## For the programmer

The object Symbol is a type, with ancestor class Thing.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Macaulay2Doc/ov_language.m2:990:0.