Macaulay2 » Documentation
Packages » Macaulay2Doc :: getGlobalSymbol
next | previous | forward | backward | up | index | toc

getGlobalSymbol -- create a global symbol in a global dictionary

Synopsis

Description

If dict is omitted, then the first symbol found in the dictionaries listed in dictionaryPath will be returned. If none is found, one will be created in the first dictionary listed in dictionaryPath, unless it is not mutable, in which case an error will be signalled; perhaps that behavior should be changed.

i1 : d = new Dictionary

o1 = d

o1 : GlobalDictionary
i2 : sym = getGlobalSymbol(d,"foo")

o2 = foo

o2 : Symbol
i3 : d

o3 = d

o3 : GlobalDictionary
i4 : peek d

o4 = GlobalDictionary{"foo" => foo}
i5 : d#"foo" === sym

o5 = true
i6 : d#"asfd" = sym

o6 = foo

o6 : Symbol
i7 : peek d

o7 = GlobalDictionary{"asfd" => foo}
                      "foo" => foo

For the programmer

The object getGlobalSymbol is a compiled function.