GreaterThanLink

From OpenCog
Jump to: navigation, search

The GreaterThanLink is a kind of virtual link that evaluates to true when its two arguments evaluate to NumberNodes, and the first argument is numerically greater than the second.

For example,

(GreaterThanLink
    (PlusLink
       (NumberNode 2)
       (NumberNode 2))
    (TimesLink
       (NumberNode 3)
       (NumberNode 0.5)))

evaluates to 'true'. GreaterThanLinks can be combined with AndLink, NotLink and OrLink to create arbitrarily evaluatable crsip-logic boolean expressions. GreaterThanLinks can be evaluated with the cog-evaluate! function. The above is valid code, and thus, the above can be cut-n-pasted to the guile prompt, as (cog-evaluate! (GreaterThankLink ...)) to yield

(stv 1 1)

When used with the pattern matcher, GreaterThanLinks may contain VariableNodes; they are evaluated when the VariableNodes are grounded.

See also