| Search internet |
The base page defines a function named
which returns the value of the parse tree t for the cache c. The value of s can be used to assign values to free variables in t.
The value of s must be an association list, i.e. a list of form

where
is a variable given as a parse tree and
is the associated value.
It is usual to invoke the eval function as
, i.e. to invoke it with an empty association list.
A 'variable' is a parse tree whose principal operator does not have a value of its own. In other words, a variable is a parse tree whose principal operator is not a string, not a page symbol, and does not have a value definition according to the codex c. Feel free to include non-variables in the association list s; the eval function will just ignore them.
Unbound variables have value
. This holds both for the eval function and for value definitions which have unbound variables in their right hand side. If you think eval should complain about unbound variables, write your own eval. If you think lgc(1) should whine when it sees an unbound variable in the right hand side of a value definition, write a verifier which detects that problem. As usual, if you want to share your work, publish it on Logiweb.
Variables are compared using tree equality. Thus, variables like
and
are distinct variables even though they both have a subscript construct as principal operator. Variables like
and
can be used both in the association list s passed to the eval function and in left hand sides of value definitions.
| Search logiweb.eu |