(defvar *db*) ; atomic facts (defvar *rules*) (defun assrt (fact) ; assert a new fact (or (member fact *db*) ; already known (progn (push fact *db*) ; add fact to *db* (dolist (rule *rules*) (if (and (member fact (cdr rule)) (every #'(lambda (x) (member x *db*)) (cdr rule))) (assrt (car rule)) ) ) ) ))
(setq *db* '()) (setq *rules* '((c a b) (e c d))) > (assrt 'a) > (assrt 'b) > *db* (C B A) > (assrt 'd) > *db* (E D C B A)
Contents    Page-10    Prev    Next    Page+10    Index