Re: On production rules and phase I&II

> Ok, then: do not bother with Prolog. Let us retrict Pure Horn to Datalog
> (already a substantial concession, but never mind!) and now your (or anyone's)
> exercise is to do recursive transitive closure in pure PRs (i.e., using only
> asserts and no meta-rules) as in:
> 
> 	ancestor(X,Y) :- parent(X,Y).
> 	ancestor(X,Y) :- parent(X,Z), ancestor(Z,Y).
> 
> -hak

I would say this (in a stylized language):

        parent(X,Y) -> assert(ancestor(X,Y))
	parent(X,Z), ancestor(Z,Y) -> assert(ancestor(X,Y))

Note that RETE-style languages are not the only known production rule
languages.


	--michael  

Received on Wednesday, 8 March 2006 18:56:58 UTC