I haven't posted anything about pyRete for a while. Development hasn't stopped. It has just slowed down to really really slow. I'm sad to say that my rule compiler algorithm that is supposed to translate a Python compiler.AST to a (hopefully, at some point, optimized) Rete Network is far too complicated.
I'm on my third attempt of refactoring, things are going the right way, but it's moving very slowly ahead. Irritating slow. The main problem is still the Test nodes, I also need to implement Not and Exists but I haven't even started on them yet so God only knows what kind of trouble that will put me in.
I've gotten as far as actually constructing a "correct" Rete Network from, for example:
>>> @pyRete.Rulebut it doesn't propagate facts correctly yet.
... def foo(a = int, b = int):
... ab = a + b
... if ab == 9:
The thing is that, as a new fact object activates the Test Node it needs to generate all possible combinations of that object (bound to a variable name) and all other variable's possible values in order to evaluate the expression (in the example: a+b) and store the result in an AlphaMemory which can be used by an AlphaNode (to test: ab == 9).
I don't know if it is the best way, or even a good way, to enable expressions in a rule's LHS but it's one way of doing it and if I get it working at some point I might figure out a better way after testing, testing and testing.