Kenny Tilton writes:
The bigger problem is that half-way thru I remembered that I kind of like the idea of setting a model in motion and then just having it run without further input because one change always leads to another. We'd have to have a hook somewhere to stop and check the event queue so the poor user can get in on the fun.
I cannot say for sure I will ever do that, but it Sounds Right. So I will look instead at maintaining a simulated propagation stack just to help debugging (a known need) with an eye towards someday possibly implementing "rule calculation backout". Am I right that the condition system would be too slow for logic programming? You mentioned the rule would "call FAIL". What would FAIL do?
FAIL would do some sort of nonlocal exit :-)
Uhm, I'm not sure. Currently, the FAIL I have signals a NO-VALID-STATE condition, the code that runs the generators establishes a BACKTRACK restart, and wrapped around the very outside is a handler for NO-VALID-STATE that invokes the BACKTRACK restart if it can find it. I did this with the idea that Cells is probably not up to being a full-featured LP engine, so it's probably better to err on the side of letting the user hook in.
In the no-stack situation, FAIL could cause a RETURN-FROM back into the propagation machinery, which would certainly be faster. Whether that would make enough of a difference to enable a backtracking Cells to be used for more general LP stuff, I don't know. Only one way to find out, I guess.