bound-variables is a list of variables (each starting with ?
) which are already bound. body is a rule body consisting of the same kind of statements that make up the right hand side of a forward or backward chaining rule.
This macro enables rule syntax to be embedded within Lisp. The body is executed just as if it were the right hand side of a rule. All variables in the body (denoted by ?
) are taken to be unbound unless found in the list bound-variables in which case its value is taken from the Lisp variable of the same name. It is similar to the function any
but can be compiled for efficiency.
T
if the body succeeds (that is, all statements are successfully executed), else nil
(if the statements fail).
(defun my-fn (?x)
"prints all the lists which append to give ?x and
then returns NIL"
(with-rule-actions (?x)
(append ?a ?b ?x)
((format t "~%~S and ~S append to give ~S"
?a ?b ?x))
(fail)))