next | previous | forward | backward | up | top | index | toc | home

Symbol _ Thing = Thing -- assignment to an indexed variable

Synopsis

Description

i1 : x_a

o1 = x
      a

o1 : IndexedVariable
i2 : x_a = b

o2 = b

o2 : Symbol
i3 : x_a

o3 = b

o3 : Symbol
i4 : x_c

o4 = x
      c

o4 : IndexedVariable
i5 : x_c = d

o5 = d

o5 : Symbol
i6 : x_c

o6 = d

o6 : Symbol
The source code explains how it works, behind the scences.
    -- code for method: Symbol _ Thing
    -- ../../../../Macaulay2/m2/variables.m2:34-37
    Symbol _ Thing := (x,i) -> ( 
         t := valueTable x; 
         if t#?i then t#i 
         else if methodTable#?x then methodTable#x(x,i) else new IndexedVariable from {x,i} )
    ---------------------------------
    -- code for method: Symbol _ Thing = Thing
    -- ../../../../Macaulay2/m2/variables.m2:44
    Symbol _ Thing = (x,i,e) -> ( x <- x; (valueTable x)#i = e )
The package Core doesn't export the symbol valueTable, so we use debug to examine it.
i7 : debug Core
i8 : peek valueTable x

o8 = MutableHashTable{a => b}
                      c => d

See also