anchor.diff:  ;;; File: rete.lisp
   ;;; Description: Class representing the inference engine itself.
   
  -;;; $Id: rete.lisp,v 1.58 2004/09/14 17:35:10 youngde Exp $
  +;;; $Id: rete.lisp,v 1.59 2004/09/14 21:07:56 youngde Exp $
   
   (in-package "LISA")
   
  
positive.code:                   (deffacts-fact-list deffact)))
          (rete-autofacts rete)))
  
  (defmethod assert-fact ((self rete) fact &key cf)
    (declare (ignore cf))
    (ensure-fact-is-unique self fact)
    (with-truth-maintenance (self)
      (setf (fact-id fact) (next-fact-id self))
  
negative.code:            (error (make-condition 'duplicate-fact
                      :existing-fact ,existing-fact)))))))
  
  (defmacro with-unique-fact (rete fact)
    (let ((existing-fact (gensym)))
      `(unless *allow-duplicate-facts*
         (let ((,existing-fact
                (gethash (hash-key ,fact) (rete-fact-table ,rete))))
           (unless (or (null ,existing-fact)
                       (not (equals ,fact ,existing-fact)))
             (error (make-condition 'duplicate-fact
                      :existing-fact ,existing-fact)))))))
    
  (defun next-fact-id (rete)
    (incf (rete-next-fact-id rete)))
  
  