Up | Next | Tail |

A variable which has been declared share by the REDUCE share command is accessible from both modes in the same style and it represents the same algebraic value. A share variable is the easiest way to transfer data between the modes. The only restriction is that a symbolic program should assign only a legal algebraic form to it - otherwise a later access in algebraic mode can lead to problems. Example:

share hugo;

hugo :=(x+y)**2$

hugo;

symbolic;

hugo := reval {’sqrt,hugo};

algebraic;

hugo;

hugo :=(x+y)**2$

hugo;

symbolic;

hugo := reval {’sqrt,hugo};

algebraic;

hugo;

Variables which have not been declared share have different values in symbolic and algebraic mode. Nevertheless a symbolic mode program has access to the algebraic value of a symbol:

- reval(x): if the value of x is a symbol or if the parameter of reval is a directly quoted symbol the function returns the algebraic value associated with this symbol, e.g. reval(′y),
- setk(x,y) sets the algebraic value of the expression x which then must
be a symbol (or more general: a kernel) to y, e.g. setk(′z,reval′(plusu17))
^{14}

Of course a clever LISP programmer easily sees how REDUCE organizes the assignment and storage of values to algebraic variables in property lists, and he might be attempted to use this knowledge for “easier” access; please resist: otherwise your program might not run in a future version of REDUCE.

Up | Next | Front |