Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preliminary support for a subset of quads introduced by @UWN #2746

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

triska
Copy link
Contributor

@triska triska commented Jan 3, 2025

This lets us embed toplevel interactions in Prolog programs. Embedded toplevel interactions are currently ignored.

Example:

:- use_module(library(lists)).

?- member(X, "abc").
   X = a
;  X = b
;  X = c.

@triska triska marked this pull request as draft January 3, 2025 18:32
@hurufu
Copy link
Contributor

hurufu commented Jan 3, 2025

Isn't it better to use term expansion mechanism to replace them with nothing? The ability to selectively remove terms during compilation was already asked here.

@bakaq
Copy link
Contributor

bakaq commented Jan 3, 2025

I was going to ask exactly for this feature actually! This works specially nice with warnings as comments, and I think it may also make the experience with ediprolog and similar systems much nicer (though I don't use ediprolog so this is a guess)!

@triska
Copy link
Contributor Author

triska commented Jan 3, 2025

Yes this would be ideal! The issue here is that one or more answer descriptions can follow a query, so this goes beyond a single term. A description that is not preceded by a query should yield an error or be treated as a regular fact as the case might be.

@bakaq
Copy link
Contributor

bakaq commented Jan 3, 2025

The issue here is that one or more answer descriptions can follow a query [...]

Oh, so it's support also for things like this and not only actual outputs of queries in the toplevel?

?- example.
   X = 1, unexpected.
   X = 2, expected.

This notation that you seem to use is the only place I can think where more than one term comes after a query. Also, why the name "quads"?

This lets us embed toplevel interactions in Prolog programs.
Embedded toplevel interactions are currently ignored.

Example:

   :- use_module(library(lists)).

   ?- member(X, "abc").
      X = a
   ;  X = b
   ;  X = c.
@UWN
Copy link

UWN commented Jan 4, 2025

X = 2, expected.

Here, expected is not needed, because X = 2. just states this alone. Only unexpected is needed to document that that leaf answer is not expected at that very moment. In this manner the same quad can be used as bug report and test case.

Also, why the name "quads"?

Queries using answer descriptions. So this is about either plain answers, as above, or some descriptions thereof. Think of ... . produced by the top level.

@UWN
Copy link

UWN commented Jan 4, 2025

@bakaq, see the Prolog prologue for more quads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants