[top][index]
search for:

value String -- evaluate a string

Synopsis:

  • Usage: x = value s
  • Function: value -- evaluate
  • Input:
  • s, an instance of class String:
  • Output:
  • x, an instance of class Thing: the value of s
  • The contents of s 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.

    i1 : value "2 + 2"

    o1 = 4
    i2 : value "a := 33
         a+a"

    o2 = 66
    i3 : a

    o3 = a

    o3 : Symbol

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


    [top][index]
    search for: