TypeNode

From OpenCog
(Redirected from VariableTypeNode)
Jump to: navigation, search

A TypeNode is a kind of Node that acts as a type constructor for the primitive data types, the atom types. It is typically used to declare the type of a VariableNode. It can also be combined with other type constructors to declare more complex types.

Thus,for example, the declaration

TypedVariableLink
    VariableNode $F
    TypeNode "ConceptNode"

declares that the variable $F must be of the type ConceptNode. Such declarations are typically used to constrain the arguments to a LambdaLink, a GetLink, a PutLink or a BindLink.

An example of a more complex type is to use it with the SignatureLink type constructor to declare a signature [1].

Thus, for example

SignatureLink
   ListLink
       TypeNode "ConceptNode"
       TypeNode "ConceptNode"

declares the (anonymous) signature of a ListLink having exactly two ConceptNodes in its outgoing set. This anonymous type can be given a name by using the DefinedTypeNode.

See also