value

value s -- provides the value of s, which may be a symbol, string, or an expression.

i1 : a = 11111111111

o1 = 11111111111
i2 : x = quote a

o2 = a

o2 : Symbol
i3 : x

o3 = a

o3 : Symbol
i4 : value x

o4 = 11111111111
i5 : p = (expression 2)^3 * (expression 3)^2

      3 2
o5 = 2 3 

o5 : Product
i6 : value p

o6 = 72
i7 : value "2 + 2"

o7 = 4

If s is a string, its contents are treated as code in the Macaulay 2 language, parsed it in its own scope, the same way a file is, and evaluated. The string may even contain multiple lines.

i8 : value "a := 2 \n a+a"

o8 = 4

Since the local assignment to a above occurred in a new scope, the value of the global variable a is unaffected.

i9 : a

o9 = 11111111111


topindexpreviousupnext