FreeLink

From OpenCog
Jump to: navigation, search

A FreeLink is a type of Link that tracks the locations of VariableNodes in it. It serves as a base type for several link types, including EvaluationLink, DeleteLink, StateLink and FunctionLink. Its primary usefulness is in the C++ implementation of the atomspace, where it serves to cache (memoize) variable locations, for rapid beta-reduction and evaluation/execution.

Note that free variables cannot be typed; that is, it is not legal to use a VariableList to explicitly declare a variable. If you want to declare variables, you need to use a LambdaLink instead.

Note that the implementation correctly handles both the QuoteLink, and any embedded LambdaLinks. That is, quoted variables are not variables at all, they're constants, and so cannot be considered to be "free". Likewise, and bound variables are not free, so any bound variables appearing underneath a nested LambdaLink will not be considered. One the other hand, and free variables inside a nested LambdaLink will be discovered.