[plt-scheme] Re: Datalog questions

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Sun Sep 13 08:53:10 EDT 2009

On Sun, Sep 13, 2009 at 12:44 AM, Mark Engelberg
<mark.engelberg at gmail.com> wrote:
> Is there any way to:
> Stop at the first answer to a query, rather than print all answers to a query?

It would be easy to implement this, but it is not implemented
currently. Basically go into the evaluator and return the first
answer... communicating that you want this to the evaluator may be
weird, perhaps ?1 rather than ?. Or only exposing it as an API call.
What do you think?

> Show some sort of trace of all the things that are being tried and
> processed to resolve a query?

That's basically a printf in the evaluator. Easy to add.

> Express a not-equals constraint, such as:
> link(2,Y) :- link(1,Y), Y!=3.
> where such a rule would mean that you can deduce link(2,1) from
> link(1,1) but not link(2,3) from link(1,3).

This is possible, in the sense that the language would still be like
datalog, but I haven't studied how to implemented stratified datalog
evaluation. If you read the last paper linked in the acknowledgments,
it talks about this sort of thing.


> Thanks.

Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University

"The glory of God is Intelligence" - D&C 93

Posted on the users mailing list.