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

Does Trealla Prolog detect cyclic lists? #579

Open
Jean-Luc-Picard-2021 opened this issue Aug 10, 2024 · 4 comments
Open

Does Trealla Prolog detect cyclic lists? #579

Jean-Luc-Picard-2021 opened this issue Aug 10, 2024 · 4 comments

Comments

@Jean-Luc-Picard-2021
Copy link

Sometimes:

?- X=[a,b|X], length(X, N).
   throw(error(resource_error(finite_memory),length/2)).

But not here:

?- VN = ['U'=X,'V'=Y | VN], write_term(f(X,g(Y,X),Y), [variable_names(VN)]), nl.
^C

Also Ctrl-C doesn't work in the above example.

@Jean-Luc-Picard-2021
Copy link
Author

Jean-Luc-Picard-2021 commented Aug 10, 2024

Scryer Prolog seems to detect the cyclic list, but their
error messages doesn't make any sense:

?- VN = ['U'=X,'V'=Y | VN], write_term(f(X,g(Y,X),Y), [variable_names(VN)]), nl.
   error(domain_error(write_option,variable_names(['U'=_79764,'V'=_79769|...])),write_term/3).

@infradig
Copy link
Contributor

The error message makes perfect sense, it's not a valid list.

@Jean-Luc-Picard-2021
Copy link
Author

Jean-Luc-Picard-2021 commented Aug 11, 2024

I am not so sure, the test case is not yet listed here:

https://www.complang.tuwien.ac.at/ulrich/iso-prolog/variable_names#73

So you are still free to choose an error term? I was rather
expecting that length/2 and write_term/2 have the same
error term for cyclic list arguments.

Didn't test Trella Prolog update yet.

@Jean-Luc-Picard-2021
Copy link
Author

So this can be closed?

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

No branches or pull requests

2 participants