[PATCH] lisa bug: matching on retracted facts

Andy Sloane <[email protected]> Thu, 07 Jul 2005 23:00:46 -0500
Newsgroups gmane.lisp.lisa.general
Message-ID <[email protected]>
Andy Sloane wrote:
> I have a much simpler test case which more clearly demonstrates what's 
> going on, and a workaround:

...And now I have a patch.

In the node2 class, there was a specialized defmethod for 
test-against-left-memory when the right token was a remove token, but 
none for test-against-right-memory for the complementary condition. 
Adding it fixes the problem.

I don't really understand the asymmetry between "left tokens" and "right 
token" in the Rete code -- they both seem to contain one token.  Was 
there a reason this method wasn't supposed to exist?

Also, should the first test-against-right-memory method specialize to 
(left-tokens add-token), as all the other *-from-left methods do?

-Andy


diff -u -3 -p -u -r1.2 node2.lisp
--- src/rete/reference/node2.lisp	21 Jun 2005 00:23:40 -0000	1.2
+++ src/rete/reference/node2.lisp	8 Jul 2005 03:37:36 -0000
@@ -33,6 +33,14 @@
             (pass-tokens-to-successor
              self (combine-tokens left-tokens right-token)))))

+(defmethod test-against-right-memory ((self node2) (left-tokens 
remove-token))
+  (loop for right-token being the hash-value
+      of (join-node-right-memory self)
+      do (when (test-tokens self left-tokens right-token)
+           (pass-tokens-to-successor
+            self (combine-tokens
+                  (make-remove-token left-tokens) right-token)))))
+
  (defmethod test-against-left-memory ((self node2) (right-token add-token))
    (loop for left-tokens being the hash-value
        of (join-node-left-memory self)


-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar