# VariableNode

A **VariableNode** is a Node type used to represent variables. It is meant to correspond to the ordinay notion of a "variable" symbol as commonly understood in term algebra, lambda calculus, first-orderlogic or model theory. VariableNodes are * not* like variables in C, C++, perl, python, java, scheme or lisp: they do

*hold values. Instead, they are merely declarative place-holders that have a name and hold a spot within whatever Link contains them.*

**not**See BindLink, PutLink and GetLink for usage examples.

An ordinary VariableNode is untyped, and so can be thought of implicitly ranging over all possible values in some universe. Note, however, that VariableNodes don't actually, explicitly range over anything; they are just symbols that are not constants. The semantics of the symbol depends on the context, and on the evaluator that is manipulating the expressions that contain variables in them. So, for example, when used in a BindLink, a VariableNode plays more-or-less the same role that a 'bound variable' does in lambda calculus or proof theory.

VariableNodes can be typed, by using the TypedVariableLink to specify its type. In this case, the variable is expected to behave in the same way that it would in type theory.

VariableNodes can be converted into constants by quoting them with a QuoteLink.

In the pattern matcher, a single VariableNode can only be grounded by one Atom. The GlobNode can be used to perform wild-card matching for multiple atoms in a sequence (see glob on wikipedia.)

## Semantics

There are currently several different subsystems in OpenCog that use variables, these are:

- The pattern matcher, which evaluates BindLinks to find groundings for variables.
- The PLN evaluator, which works with fixed formulas that set truth values when evaluating ForAllLinks and ExistsLinks.
- The microplanner, for assembling natural-language sentences.
- The Relex2Logic layer, for converting natural-language sentences into logic expressions.

Each of these systems give a different semantics to VariableNodes.

The natural language learning code uses AnyNode instead of VariableNode. Perhaps AnyNode should be made obsolete, and replaced by VariableNode.