-------- Original Message -------- Subject: Re: [cells-devel] Logic Programming in Cells Date: Tue, 24 May 2005 12:37:50 -0400 From: Kenny Tilton ktilton@nyc.rr.com To: Thomas F. Burdick tfb@OCF.Berkeley.EDU References: 17043.19525.48820.752685@conquest.OCF.Berkeley.EDU
Thomas F. Burdick wrote:
I was looking to build a Prolog-ish logic-programming layer on top of Cells, and looking at how to do this, it looks like basic support could be added to Cells itself pretty easily. Here's what I'm thinking. We add a new type of Cell, let's call it a Generator. Data propogation proceeds as usual, but when we get to a Generator, we mark this on a stack. If evaluation of some formula calls FAIL, we go back to the last Generator, evaluate it again, and resume data propogation from there. Any pending inputs from code that was backtracked over would of course be thrown out.
Any thoughts?
So the generator sits there trying different values, with nested generators each working thru their values? The generator needs to be able to keep track of where it is between evaluations, including knowing when it is starting a fresh search (if you will).
Are you up to speed on the new propagation scheme, as featured most prominently in "unfinished-business"? I guess teh good news is that propagation to dependent cells completes before any output is done, so you do not have to back out outputs (and rules are not supposed to have side effects, tho I did just that in the Dwo Jones use case <gasp>.).
But what about the dependency propagation itself? A retry by the Generator may not propagate to the same population, so some positive mechanism must un-calculate dependencies reached during any failed propagation. Too bad I am not using the stack any more....Just had an idea. I need to look at the logic again, but what if we let dependency propagation take place on the stack. One nice thing here is that I was just about to /fake/ a stack just for debugging purposes, so I could figure out where problematic data pulses were originating. So either we do not need to do that, or that supports the backtracking you will need.
Again, have you been thinking about these issues? Either way, am I in the right ballpark approach-wise?
kt