ArityLink

From OpenCog
Jump to: navigation, search

The ArityLink is a type of FunctionLink that, when executed returns a NumberNode having the value of the number of arguments it holds. It is useful for counting the number of values returned by a GetLink.

DEPRECATED! There are multiple fundamental problems with the idea here. First, there is the problem that this pollutes the AtomSpace with lots of NumberNodes, which can become hard to remove. In general, it is much better to use Values for fleeting data. Thus, it would probably be better if there was a ArityValue type that derived from LinkValue, and returned a count that way.

A second, and perhaps more serious problem is that this is based on the assumption that GetLink will continue to return SetLinks of results. However, SetLinks cause deep problems for the AtomSpace, and AtomSpace memory management. The are fairly strongly deprecated; see https://github.com/opencog/atomspace/issues/1502 to see the current status on making SetLinks obsolete.