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

Write option max_depth/1 #1876

Open
UWN opened this issue Jul 10, 2023 · 6 comments
Open

Write option max_depth/1 #1876

UWN opened this issue Jul 10, 2023 · 6 comments

Comments

@UWN
Copy link

UWN commented Jul 10, 2023

See GNU: didoudiaz/gprolog#56

@UWN
Copy link
Author

UWN commented Jul 10, 2023

Related: #1803

@UWN
Copy link
Author

UWN commented Jul 11, 2023

A comparison with SICStus:

?- nth1(I,[1+2+3+4,_^_^_^_^_,1^2^3^4^nil,[1,2,3,4],[_,_,_,_]],T),between(0,5,D),write(I-D),write(' '),write_term(T,[max_depth(D)]),nl,false.
%   SICStus                           Scryer
1-0 1+2+3+4                       1-0 1+2+3+4
1-1 ... + ...                     1-1 ... + ... +4
1-2 ... + ... +4                  1-2 ... + ... +3+4
1-3 ... + ... +3+4                1-3 1+2+3+4
1-4 1+2+3+4                       1-4 1+2+3+4
1-5 1+2+3+4                       1-5 1+2+3+4
2-0 _1143^_1179^_1215^_1251^_1287 2-0 _535229^_535245^_535259^_535271^_535272
2-1 _1143^ ...                    2-1 _535229^ ... ^ ...
2-2 _1143^_1179^ ...              2-2 _535229^_535245^ ... ^ ...
2-3 _1143^_1179^_1215^ ...        2-3 _535229^_535245^_535259^ ... ^ ...
2-4 _1143^_1179^_1215^_1251^_1287 2-4 _535229^_535245^_535259^_535271^_535272
2-5 _1143^_1179^_1215^_1251^_1287 2-5 _535229^_535245^_535259^_535271^_535272
3-0 1^2^3^4^nil                   3-0 1^2^3^4^nil
3-1 ... ^ ...                     3-1 1^ ... ^ ...
3-2 1^ ... ^ ...                  3-2 1^2^ ... ^ ...
3-3 1^2^ ... ^ ...                3-3 1^2^3^ ... ^ ...
3-4 1^2^3^ ... ^ ...              3-4 1^2^3^4^nil
3-5 1^2^3^4^nil                   3-5 1^2^3^4^nil
4-0 [1,2,3,4]                     4-0 [1,2,3,4]
4-1 [...|...]                     4-1 [1,...]              Suggested: [1|...]
4-2 [1,2|...]                     4-2 [1,2,...]
4-3 [1,2,3|...]                   4-3 [1,2,3,...]
4-4 [1,2,3,4]                     4-4 [1,2,3,4]
4-5 [1,2,3,4]                     4-5 [1,2,3,4]
5-0 [_1581,_1613,_1645,_1677]     5-0 [_535278,_535287,_535291,_535293]
5-1 [_1581|...]                   5-1 [_535278,...]
5-2 [_1581,_1613|...]             5-2 [_535278,_535287,...]
5-3 [_1581,_1613,_1645|...]       5-3 [_535278,_535287,_535291,...]
5-4 [_1581,_1613,_1645,_1677]     5-4 [_535278,_535287,_535291,_535293]
5-5 [_1581,_1613,_1645,_1677]     5-5 [_535278,_535287,_535291,_535293]

@UWN
Copy link
Author

UWN commented Jul 13, 2023

Here is probably the smallest incorrect term:

?- write_term([_,_|_],[max_depth(1)]).
[_535624,...]   true, unexpected.

@mthom
Copy link
Owner

mthom commented Jul 21, 2023

Why do 2-1 and 3-1 differ in SICStus (they differ in whether the left operand is substituted by ...)? That makes absolutely no sense to me.

mthom added a commit that referenced this issue Jul 21, 2023
@UWN
Copy link
Author

UWN commented Jul 22, 2023

What does a ... stand for? In an abbreviated term, it either stands for itself (should the program itself use this atom), or it stands for another non-variable term. Variables do not need to be abbreviated, they are short enough by themselves.

@triska
Copy link
Contributor

triska commented Sep 3, 2023

?- write_term("ab", [max_depth(1)]).
[a,b]   true, unexpected.

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

3 participants