CLIPS FunctionsΒΆ

CLIPS provides many useful functions (see chapter 12 of the CLIPS Reference Manual) for use in rule definitions. All these functions may be used in Rulu as follows:

greeting.py

from rulu import *

# Declare a built-in CLIPS function by name and return value.
strcat = clips_func('str-cat', String)

class Entity(Fact):
    name = StringField()
    
Greeting = RuleDef(
    action(Assert(text=strcat("Hello, ", Entity.name, "!")))
)

Input Facts

Entity name
0 World

Output Facts

Greeting text
0 Hello, World!