Skip to content

More Accesible Quad Module #3313

Open
constraintAutomaton wants to merge 8 commits into
mthom:masterfrom
constraintAutomaton:more-accesible-quad
Open

More Accesible Quad Module #3313
constraintAutomaton wants to merge 8 commits into
mthom:masterfrom
constraintAutomaton:more-accesible-quad

Conversation

@constraintAutomaton
Copy link
Copy Markdown

Description

This branch makes Scryer's quad-based testing easier to discover and easier to use programmatically.

  • The quadtests, testutils, and special_functions modules move out of src/lib/numerics/ and into a new src/lib/testing/ directory. I think they are not really numerics specific and the module name offuscate a bit the purpose of quads.

  • evaluated_quads/2 predicate created. This predicate return an term evaluation(passed(Passed), rejected(Rejected)) and does not have a side effect of printing in the top level, to enable better reasoning over the quad answer.

  • Documentation added for the module and in the README.md.

related to #3303 and #3301

@constraintAutomaton constraintAutomaton marked this pull request as draft April 26, 2026 11:12
@constraintAutomaton
Copy link
Copy Markdown
Author

I will make the example more interesting and demonstrative of Scryer Prolog capability.

@constraintAutomaton constraintAutomaton marked this pull request as ready for review May 1, 2026 07:20
@constraintAutomaton
Copy link
Copy Markdown
Author

@UWN Do you think those examples and the new interface is representative of the intended usage of quads?


## Errors

A goal that should throw an error can be exercised with `catch/3`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why? The error can be directly used as answer description:

?- functor(X, F, A).
   error(instantiation_error,functor/3).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like it is not currently supported.

If I do this

:- module(foo, [foo/1]).

foo(a) :- throw(custom_error(bar)).
foo(b).

?- foo(b).
  true.
?- foo(a).
  throw(custom_error(bar)).

and in my top-level

check_module_quads(foo, X).

I get this

 false.

if I remove the quad then I get a valid answer,

Copy link
Copy Markdown
Author

@constraintAutomaton constraintAutomaton May 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is indeed a bug/unexpected behavior and not a mistake from my part, I can fix it with this PR. Given you think it is in scope for this PR.

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.

2 participants