-
Notifications
You must be signed in to change notification settings - Fork 13
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 #250
Comments
And here it is perfect:
|
|
Sorry, fixed now. Only the first part of issue though, not the ... part.
…On Mon, Jul 10, 2023 at 6:26 PM UWN ***@***.***> wrote:
Trealla Prolog (c) Infradig 2020-2023, v2.21.31
?- write_term(t,[max_depth(-1)]).
error(domain_error(write_option,max_depth(-1)),write_term/2).
t?-
^^ unexpected t
—
Reply to this email directly, view it on GitHub
<#250 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFNKSETV7WTQFO65UU2TDWTXPO4DLANCNFSM6AAAAAA2EDPZWM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Pushed tests for this de facto standard option (of the Prolog systems supported by Logtalk, only B-Prolog, CxProlog, and JIProlog fail to support it):
The main difference I found in error-checking is with negative depth values. Ciao Prolog, LVM, SICStus Prolog, Trealla Prolog, and XSB throw a domain error. But others like ECLiPSe, GNU Prolog, and SWI-Prolog accept them. YAP doesn't try to type-check the depth. |
?- D=3,write_term([1,2,3,4],[max_depth(3)]). [1,2,3|...] D = 3. % OK ?- D=3,write_term([1,2,3,4],[max_depth(D)]). [1,2,3,4] D = 3, unexpected. |
Fix pushed for this, used wrong issue # in commit.
…On Mon, 10 July 2023, 20:27 UWN, ***@***.***> wrote:
?- D=3,write_term([1,2,3,4],[max_depth(3)]).
[1,2,3|...] D = 3. % OK
?- D=3,write_term([1,2,3,4],[max_depth(D)]).
[1,2,3,4] D = 3, unexpected.
—
Reply to this email directly, view it on GitHub
<#250 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFNKSESVU3E5SVB5RKKXWEDXPPKK7ANCNFSM6AAAAAA2EDPZWM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Taking the observations from didoudiaz/gprolog#56
The 2nd point now works, the first not. Here is a comparison with SICStus which seems the way to go except for 4-1:
|
Added a test for this unexpected output. With v2.22.0 (916748d), this and other new tests all pass:
|
Now:
Do you really intend to replace variables by |
It's ongoing work.
…On Thu, 13 July 2023, 13:29 UWN, ***@***.***> wrote:
Now:
?- nth0(I,[A+B+C+D,1+2+3+4,A^B^C^D^E,1^2^3^4^nil,[1,2,3,4],[A,B,C,D],[- -A,- -B,- -C,- -D],[[A,B,C,D]],[[[[[A,B,C,D]]]]]],T),
between(0,5,M), write(I-M), write(' '),
write_term(T,[variable_names(['A'=A,'B'=B,'C'=C,'D'=D,'E'=E]),max_depth(M)]), nl, false.
SICStus Trealla
0-0 A+B+C+D 0-0 A+B+C+D
0-1 ... +D 0-1 ... + ...
0-2 ... +C+D 0-2 ... + ... +D
0-3 A+B+C+D 0-3 ... + ... +C+D
0-4 A+B+C+D 0-4 A+B+C+D
0-5 A+B+C+D 0-5 A+B+C+D
1-0 1+2+3+4 1-0 1+2+3+4
1-1 ... + ... 1-1 ... + ...
1-2 ... + ... +4 1-2 ... + ... +4
1-3 ... + ... +3+4 1-3 ... + ... +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 A^B^C^D^E 2-0 A^B^C^D^E
2-1 A^ ... 2-1 ... ^ ...
2-2 A^B^ ... 2-2 A^ ... ^ ...
2-3 A^B^C^ ... 2-3 A^B^ ... ^ ...
2-4 A^B^C^D^E 2-4 A^B^C^ ... ^ ...
2-5 A^B^C^D^E 2-5 A^B^C^D^E
3-0 1^2^3^4^nil 3-0 1^2^3^4^nil
3-1 ... ^ ... 3-1 ... ^ ...
3-2 1^ ... ^ ... 3-2 1^ ... ^ ...
3-3 1^2^ ... ^ ... 3-3 1^2^ ... ^ ...
3-4 1^2^3^ ... ^ ... 3-4 1^2^3^ ... ^ ...
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|...]
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 [A,B,C,D] 5-0 [A,B,C,D]
5-1 [A|...] 5-1 [A|...]
5-2 [A,B|...] 5-2 [A,B|...]
5-3 [A,B,C|...] 5-3 [A,B,C|...]
5-4 [A,B,C,D] 5-4 [A,B,C,D]
5-5 [A,B,C,D] 5-5 [A,B,C,D]
6-0 [- -A,- -B,- -C,- -D] 6-0 [- -A,- -B,- -C,- -D]
6-1 [...|...] 6-1 [- ...|...]
6-2 [- ...,- ...|...] 6-2 [- ...,- ...|...]
6-3 [- -A,- -B,- ...|...] 6-3 [- ...,- ...,- ...|...]
6-4 [- -A,- -B,- -C,- ...] 6-4 [- -...,- -...,- -...,- -...]
6-5 [- -A,- -B,- -C,- -D] 6-5 [- -A,- -B,- -C,- -D]
7-0 [[A,B,C,D]] 7-0 [[A,B,C,D]]
7-1 [...] 7-1 [[...|...]]
7-2 [[A|...]] 7-2 [[...,...|...]]
7-3 [[A,B|...]] 7-3 [[A,B,C|...]]
7-4 [[A,B,C|...]] 7-4 [[A,B,C,D]]
7-5 [[A,B,C,D]] 7-5 [[A,B,C,D]]
8-0 [[[[[A,B,C,D]]]]] 8-0 [[[[[A,B,C,D]]]]]
8-1 [...] 8-1 [[...]]
8-2 [[...]] 8-2 [[...]]
8-3 [[[...]]] 8-3 [[[...]]]
8-4 [[[[...]]]] 8-4 [[[...]]]
8-5 [[[[[A|...]]]]] 8-5 [[[[...]]]]
Do you really intend to replace variables by ...? It starts with 0-1...
4-1 is definitely an improvement. But what happens in 8 is not clear to me
at all, with increasing depth, also the lists should resurface, one by one.
—
Reply to this email directly, view it on GitHub
<#250 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFNKSEX5VHULVXENXUB66YDXP5TRXANCNFSM6AAAAAA2EDPZWM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
This is currently an implementation specific extension, but it is handled incorrectly:
The text was updated successfully, but these errors were encountered: