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

Update custom constraint example #24

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

jeshan
Copy link

@jeshan jeshan commented Oct 22, 2023

Syntax usage was outdated (since clpfd days).
It took me quite some head scratcing to realise that run_propagator extensions should be a dcg rule nowadays!

Syntax usage was outdated (since clpfd days)
@jeshan
Copy link
Author

jeshan commented Oct 22, 2023

I suppose it should be updated for scryer as well
https://github.com/mthom/scryer-prolog/blob/master/src/lib/clpz.pl

but somehow it rejects the syntax for mysterious reasons.

@jeshan
Copy link
Author

jeshan commented Oct 22, 2023

Turns out that this too isn't complete yet: after I load that code (that has clpz:run_propagator), I see that zcompare(A,B,C) no longer holds elsewhere!

Can @triska clarify of a minimum working example?

update: adding :- multifile clpz:run_propagator/4. to both the snippet example and the library code fixes the issue.

declare run_propagator/4 as multifile and format example
Copy link

@UWN UWN left a comment

Choose a reason for hiding this comment

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

Just because I see it: Put round brackets around the argument of the directive and since this is a non-terminal use //. Thus replace

:- multifile clpz:run_propagator/2.

by

:- multifile(clpz:run_propagator//2).

@jeshan
Copy link
Author

jeshan commented Oct 23, 2023

Ulrich, I could change it but Sicstus rejects the double slash as "invalid predicate indicator".
:- multifile(clpz:run_propagator/4). works fine.

! Type error in argument 1 of (multifile)/1
! expected dynamic_decl, but found clpz:run_propagator//2
! goal:  multifile clpz:run_propagator//2
! Approximate lines: 2414-2415, file: '/path/to/file.pl'
The procedure run_propagator/4 is being redefined from multifile to non-multifile.
    New file: /path/to/file.pl
Do you really want to redefine it?  (y, n, p, s, a, b, or ?) 

image

Maybe we leave it as is for Sicstus but update the scryer version instead?

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