Unexpected.
Deleted, no longer relevant, inserted.
See source for modification dates.
$ make OPT=-std=gnu99
?- A=A*C,B=A*A,dif(A,B),C=1. false, unexpected.
?- A=A*B,B=C*C,B=C,dif(A,B). false. ?- dif(A,B),A=A*B,B=C*C,B=C. A = A*(C*C), B = C*C, C = C*C, unexpected, unsound.
?- dif(A,B),A=B*[],B=A*B. A = B*[], unexpected. % missing B = ... ?- A=B*[],B=A*B,dif(A,B). A = B*[], dif:dif(B*[],B*[]*B), unexpected. % and missing B = ...
?- [issue394]. true. ?- ti(G=Rs). G = (dif(_A,_B),_B=[]*[],_A=[]*_C), Rs = [0], unexpected ; G = (_A=[]*[],_B=[]*_C,dif(_B,_A)), Rs = [1]. ?- ti(G=Rs), G. G = (dif([]*_A,[]*[]),[]*[]=[]*[],[]*_A=[]*_A), Rs = [0] % plus missing dif ; G = ([]*[]=[]*[],[]*_A=[]*_A,dif([]*_A,[]*[])), Rs = [1]. % missing dif
?- A=C*B, C = c, B = b, dif(A,B). A = c*b, C = c, B = b. ?- dif(A,B), A=C*B, C = c, B = b. false, unexpected.
?- A=B*A,dif([],A). A = B*A. ?- dif([],A),A=B*A. false, unexpected, incomplete.
?- A+B#=C. false, unexpected.
?- L=A*L,L=L*A,A=a. false. ?- dif([],A),L=A*L,L=L*A,A=a. A = a, L = a*L, unexpected. false.
Trealla Prolog (c) Infradig 2020-2023, v2.27.60 ?- findall(t,(B in 0..1,(B=0;B=1),A#>B,v(A,B)=v(1,0)),C). loops, unexpected.
?- findall(t,(dif([],A),[]*[]=A*a),Res). Res = [] ; error(instantiation_error,callable), unexpected.
?- dif([],A),L=[]*a,L=B*A. false, unexpected, incomplete. A = a, L = []*a, B = []. % expected, but not found
?- dif(A,[]),A=B*A. A = B*(B*(B*(B*(B*(B*(B*(B*(B*(B*(B*(B*(B*(B*(B*(B*(B*(B*(B* ...)))))))))))))))))), % good so farFull text now:dif:dif(B*(B*(B* ...(B*(*()))... ))). % unexpected, bad syntax, too deep
?- dif(A,[]),A=B*A. A = B*A, dif:dif(B*(B*A),[]), unexpected. A = B*A. % expected, but not found
?- [A,B] ins 0..1,A#= -B. false, unexpected, incomplete. ?- A=0, [A,B] ins 0..1,A#= -B.2.27.21A = 0, B = A % good ; false, unexpected. % determinism expectedA = 0, B = A. % perfect ?- A in 0..1, A#= -B.clpz:(-1*B#=A),clpz:(A in 0..1),clpz:(B in -1..0) % good ; false, unexpected. clpz:(-1*B#=A),clpz:(A in 0..1),clpz:(B in -1..0). ?- A in 0..1, A#= -B, B in 0..1.A = 0, B = A ; false, unexpected. A = 0, B = A. ?- A in 0..1, B in 0..1, A#= -B. false, unexpected, incomplete. ?- A in 0..1, B in 0..1, A #= -B, A = 0, B = 0. false, unexpected, incomplete. A = 0, B = 0. % expected, but not found
?- A=B,A=A*1,B=B*B. false. ?- A=A*1,B=B*B,A=B. A = ... * ... * 1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1, B = 1, unexpected. false. % expected, but not found(Same as Item#55) Still in 2.27.21
?- [user]. :- set_prolog_flag(occurs_check,true). true. ?- current_prolog_flag(occurs_check,V). V = false, unexpected.
?- [user]. p(X,X). true. ?- set_prolog_flag(occurs_check,error). true. ?- A=f(A). error(representation_error(term),(=)/2). ?- p(A,f(A)). false, unexpected.
?- A=B,A=B*1,B=B*A*B,A=B. false. ?- set_prolog_flag(answer_write_options,[max_depth(2)]). true. ?- A=B*1,B=B*A*B,A=B. A = ... * ... * 1, B = ... * ... * ( ... * ...), unexpected.
?- set_prolog_flag(answer_write_options, non_list). error(type_error(list,non_list),set_prolog_flag/2), unexpected. domain_error(flag_value, answer_write_options+non_list). % 8.17.1.3 e ?- set_prolog_flag(answer_write_options, double_quotes(ummy)). error(type_error(atomic,double_quotes(ummy)),set_prolog_flag/2), unexpected. domain_error(flag_value, answer_write_options+double_quotes(ummy)). ?- set_prolog_flag(answer_write_options, [double_quotes(ummy)]). error(domain_error(flag_value,double_quotes(ummy)),set_prolog_flag/2), unexpected. domain_error(flag_value, answer_write_options+double_quotes(ummy)).Use the second argument of
error/2 in case more specific
errors are desired.
?- current_prolog_flag(answer_write_options,Opts). Opts = [max_depth(19),quoted(ummy),double_quotes(ummy)], unexpected.
?- A=B,A=A*1,B=B*B,A=B. false. ?- A=A*1,B=B*B,A=B. A = ... * ... * 1*1*1*1*1, B = 1, unexpected.
?- B=C*(A*B),A=B*B,A=B.Still open:loops, unexpected. ?- B=C*(A*B),A=B*B,A=B, false.loops, unexpected. false. % expected, but not found ?- B=B*(A*B),A=B*B,A=B. B = ... * ... * ( ... * ...)*( ... * ... * ( ... * ...))*( ... * ... * ( ... * ...)*( ... * ... * ( ... * ...))), A = ... * ... * ( ... * ...)*( ... * ... * ( ... * ...))*( ... * ... * ( ... * ...)*( ... * ... * ( ... * ...))), unclear. false, unexpected. % would be unexpected ?- B=B*(A*B),A=B*B,A=B, A == B. false, unexpected. ?- time((B=B*(A*B),A=B*B,A=B,false)).% Time elapsed 0.514s, 5 Inferences, 0.000 MLipsfalse. ?- B+A+A=_*(A*B)+B*B+B.loops, unexpected.
?- \+ \+ ( B=B*(A*B),A=B*B,A=B ). true. ?- \+ \+ ( B=B*(A*B),A=B*B,A=B, A == B ). false, unexpected.Now incorrect
?- \+ \+ ( B=B*(A*B),A=B*B,A=B ). false, unexpected. true.
?- A=B,C=A*1,A=B*A,B=B*C*A,A=B. false. ?- C=A*1,A=B*A,B=B*C*A,A=B. C = ... * ... * ( ... * ...)*1, A = ... * ... * ( ... * ...)*( ... * ... * ( ... * ...)), B = ... * ... * ( ... * ...)*( ... * ... * ( ... * ...)), unexpected. ?- C=A*1,A=B*A,B=B*C*A,A=B, A == B. false. ?- set_prolog_flag(answer_write_options,[max_depth(4)]). true. ?- C=A*1,A=B*A,B=B*C*A. C = ... * ... * ( ... * ...)*( ... * ... * ( ... * ...))*1, A = ... * ... * ( ... * ...)*( ... * ... * ( ... * ...))*( ... * ... * ( ... * ...)*( ... * ... * ( ... * ...))), B = ... * ... * ( ... * ...)* ( ... * ... * 1)*( ... * ... * ( ... * ...)*( ... * ... * ( ... * ...))), unclear. false, unexpected. % would there be failure, then this would be unexpected ?- C=A*1,A=B*A,B=B*C*A, A = B. C = ... * ... * ( ... * ...)*( ... * ... * ( ... * ...))*1, A = ... * ... * ( ... * ...)*( ... * ... * ( ... * ...))*( ... * ... * ( ... * ...)*( ... * ... * ( ... * ...))), B = ... * ... * ( ... * ...)* ( ... * ... * 1)*( ... * ... * ( ... * ...)*( ... * ... * ( ... * ...))), unexpected.
?- set_prolog_flag(answer_write_options,[max_depth(2)]). true. ?- A=B,B=B*A*A,A=B*1,A=B. false. ?- B=B*A*A,A=B*1,A=B. B = ... * ... * ( ... * ...), A = ... * ... * 1, unexpected.
?- current_prolog_flag(N,V), V = [_|_]. N = answer_write_options, V = [max_depth(19),quoted(true)], unexpected. ?- L = [a,b,c]. L = "abc". % ok only with double_quotes(true) ?- write_term([a,b,c],[max_depth(19),quoted(true)]). [a,b,c] true. ?- write_term([a,b,c],[max_depth(19),quoted(true),double_quotes(true)]). "abc" true.
?- A=B,A=B*1,A=1*1*1. A = ... * ... * 1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1, B = ... * ... * 1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1*1, unexpected.
?- writeq([a|\+1]). [a|(\+1)] true.
?- set_prolog_flag(answer_write_options,[max_depth(2)]). true. ?- A=B,A=B*1,B=B*A*B,A=B. false. ?- A=B*1,B=B*A*B,A=B. A = ... * ... * 1, B = ... * ... * ( ... * ...), unexpected. ?- A=B,A+B=B*1+B*A*B. false. ?- A+B=B*1+B*A*B. A = ... * ... * 1, B = ... * ... * ( ... * ...). ?- A+B=B*1+B*A*B,A=B. A = ... * ... * 1, B = ... * ... * ( ... * ...), unexpected.With branch
reflist v2.25.18-17-gce4a
?- A=B,B=B*A*A,A=B*1,A=B. false. ?- B=B*A*A,A=B*1,A=B. B = ... * ... * ( ... * ...), A = ... * ... * 1, unexpected. ?- A=B*1,B=B*A*A,A=B. false.(still broken in main not in reflist)
?- set_prolog_flag(answer_write_options,[max_depth(1)]). true. ?- A = [a,b,c]. A = "ab|...", unexpected. A = [a|...] | % alternative from Ciao A = "a"||... . ?- A = "abc". A = "abc", unexpected. A = [a|...] | % alternative from Ciao A = "a"||... . ?- A = [1,2,3]. A = [1|...].Ciao: A possible more compact syntax for partial strings.
Trealla Prolog (c) Infradig 2020-2023, v2.25.15 ?- A=B,A=B*1,B=B*A*A,A=B. false. ?- A=B*1,B=B*A*A,A=B. A = ... * ... * ( ... * ...)*( ... * ... * 1)*( ... * ... * ( ... * ...)*1)*( ... * ... * ( ... * ...)*( ... * ... * 1)*1)*( ... * ... * ( ... * ...)*( ... * ... * 1)*( ... * ... * ( ... * ...)*1)*1)*( ... * ... * ( ... * ...)*( ... * ... * 1)*( ... * ... * ( ... * ...)*1)*( ... * ... * ( ... * ...)*( ... * ... * 1)*1)*1)*( ... * ... * ( ... * ...)*( ... * ... * 1)*( ... * ... * ( ... * ...)*1)*( ... * ... * ( ... * ...)*( ... * ... * 1)*1)*( ... * ... * ( ... * ...)*( ... * ... * 1)*( ... * ... * ( ... * ...)*1)*1)*1)*1, B = ... * ... * ( ... * ...)*( ... * ... * 1)*( ... * ... * ( ... * ...)*1)*( ... * ... * ( ... * ...)*( ... * ... * 1)*1)*( ... * ... * ( ... * ...)*( ... * ... * 1)*( ... * ... * ( ... * ...)*1)*1)*( ... * ... * ( ... * ...)*( ... * ... * 1)*( ... * ... * ( ... * ...)*1)*( ... * ... * ( ... * ...)*( ... * ... * 1)*1)*1)*( ... * ... * ( ... * ...)*( ... * ... * 1)*( ... * ... * ( ... * ...)*1)*( ... * ... * ( ... * ...)*( ... * ... * 1)*1)*( ... * ... * ( ... * ...)*( ... * ... * 1)*( ... * ... * ( ... * ...)*1)*1)*1)*( ... * ... * ( ... * ...)*( ... * ... * 1)*( ... * ... * ( ... * ...)*1)*( ... * ... * ( ... * ...)*( ... * ... * 1)*1)*( ... * ... * ( ... * ...)*( ... * ... * 1)*( ... * ... * ( ... * ...)*1)*1)*( ... * ... * ( ... * ...)*( ... * ... * 1)*( ... * ... * ( ... * ...)*1)*( ... * ... * ( ... * ...)*( ... * ... * 1)*1)*1)*1), unexpected. ?- set_prolog_flag(answer_write_options,[max_depth(2)]). true. ?- A=B*1,B=B*A*A,A=B. A = ... * ... * 1, B = ... * ... * ( ... * ...), unexpected.
Trealla Prolog (c) Infradig 2020-2023, v2.23.47 ?- A=B,A+B+C=C*2+A*2+C*1*2,A=B. false. ?- A+B+C=C*2+A*2+C*1*2,A=B. A = ... * ... * 2*1*2*1*2*1*2*2, B = ... * ... * 1*2*1*2*1*2*2*2, C = ... * ... * 1*2*1*2*1*2*1*2, unexpected.edift-nth(4:101988473)
?- writeq('\033\').
'\e' true.
?- write_canonical('\033\').
'\e' true.
?- writeq('\e').
'\e' true.
As a consequence, Trealla writes Prolog text that cannot be read by
standard conforming processors.
?- L=[_,_,_], setof(t,member(E,L),_). L = [_,_,_], E = _, unexpected, unsound. L = [E,_A,_B] ; L = [_A,E,_B] ; L = [_A,_B,E] | other_answer_sequence. % expected but not found ?- setof(t,(A=E;B=E;C=E),_). E = A, B = E, C = E, unexpected, incomplete. A = E ; B = E ; C = E | other_answer_sequence. % expected but not found
?- (N=0;N=1;N=3),length(_,N),length(E,2),portray_clause(E),false. [A,B]. [B,C]. % unexpected, expected as above [D,E]. % idem false.Also
?- use_module(library(format)). true. ?- (N=0;N=1;N=3),length(_,N),length(E,2),phrase(portray_clause_(E),Xs). N = 0, E = [_A,_B], Xs = "[_22,_26]|...", unexpected ; N = 1, E = [_A,_B], Xs = "[_26,_30]|...", unexpected ; N = 3, E = [_A,_B], Xs = "[_34,_38]|...", unexpected.while Scryer gives:
?- (N=0;N=1;N=3),length(_,N),length(E,2),phrase(portray_clause_(E),Xs). N = 0, E = [_A,_B], Xs = "[A,B].\n" ; N = 1, E = [_A,_B], Xs = "[A,B].\n" ; N = 3, E = [_A,_B], Xs = "[A,B].\n".
ulrich@p0:~/ftp/trealla-prolog$ /opt/gupu/new-trealla/tpl -f item40.pl -g halt Warning: call(c=c,a=a) failed unexpected Warning: call(\+ (ti(_3,_4),_3)) failedThe second warning is fine, but the first is not. Where does it come from? And sometimes (with another program text) only the first warning is shown.
ulrich@p0:~/ftp/trealla-prolog$ /opt/gupu/new-trealla/tpl -f item40b.pl -g halt loops, unexpected
ti(G_0,(A_0,B_0, Dif_0)) :-
G_0 = (Dif_0, A_0,B_0),
Dif_0 = dif(_,_),
skel(A_0),
skel(B_0),
f(G_0).
f((dif(A,B),A=B*A,B=A*_C)).
skel(_=_*_).
?- ti(G_0,_),G_0.
G_0 = (dif(_A*(_A*_B),_A*_B*_C),_A*_B*_C*(_B*_C*_B)=_B*_C*_B*_C*(_A*_B*_C*(_B*_C*_B)),_B*_C*_B*_C=_A*_B*_C*(_B*_C*_B)*_C).
?- ti(_,R_0),R_0.
false, unexpected, incomplete.
git
describe should give a combination of an official version
number plus some counting integer plus a couple of hash bits just to
be safe. The least noise inducing way to get updates is git
pull && make && ./tpl
?- C=[],A=[A|C],B=[A|A],A=B. false. ?- C=[],A=[A|C],B=[A|A],A==B. C = [], A = [A], B = [[A],A|C], unexpected. ?- C=[],A=[A], B=[A|A],A==B. false.
?- dif(A,B),A=[A|C],B=[A|A]. A = [A|C], B = [[A|C],A|C], dif:dif(_A,_B). ?- A=[A|C],B=[A|A],dif(A,B). false, unexpected, incomplete.
?- dif(A,B),A=[A|A],B=[B|B]. loops, unexpected.Haven't we had this already?
?- dif(1,2).%. Error: syntax error, incomplete, user:1 true.?- dif(X,1).%. dif(X,1). dif(X,1).
ti(G_0, (A_0,B_0,C_0)) :- G_0 = (C_0,A_0,B_0), C_0 = unify_with_occurs_check(_,_), skel(A_0), skel(B_0), f(G_0). f((unify_with_occurs_check(A,B),unify_with_occurs_check(A,[]*C),unify_with_occurs_check(C,B*_D))). skel(unify_with_occurs_check(_,_*_)). ?- ti(G_0,_),G_0. false. ?- ti(_,R_0),R_0. R_0 = (unify_with_occurs_check([]*([]*_A*_A),[]*([]*(_B*_A)*_A)),unify_with_occurs_check([]*(_B*_A)*_A,[]*([]*_A*_A)*_A),unify_with_occurs_check([]*(_B*_A),[]*(_B*_A))), unexpected.Again, we have three goals this time without any cyclic trees, so only terms are involved. Therefore, this problem must be related to the structure sharing representation only.
?- dif([],A), A = [B]. A = [B], dif([],[B]), unexpected. ?- dif(Nihil,[B]). dif(Nihil,[B]). ?- dif(Nihil,[B]), Nihil = []. Nihil = [], dif([],[B]), unexpected.suggested solution
?- A=B*A,B=B*A*B,A=B. loops, unexpected.
?- _0=_1* [],_1=_1* [] * [],_0=_1. *** OOPS src/unify.c 1262 error(representation_error(term),(=)/2), unexpected.(Using your currrent portray_clause/1 ...)
?- A=B*A,A=B*B*B. *** OOPS src/unify.c 1267 error(representation_error(term),(=)/2), unexpected.
?- A=[A|B],B=[A,B|B],A=B, false. sto, false. ?- call_residue_vars((A=[A|B],B=[A,B|B],A=B, false),Vs), false. loops, unexpected.
?- A=[A|A],A=[B,A]. false. ?- A=B,A=[A|A],A=[B,A]. A = [A|A], B = A, unexpected, unsound.
ti(A=A). ?- ti(G_0). G_0 = (G_0=G_0), unexpected.(This used to be an incorrect program with dif/2...)
ti(G_0, R_0) :- G_0 = (A_0,B_0,C_0), R_0 = (B_0,C_0,A_0), A_0 = unify_with_occurs_check(_,_), skel(B_0), skel(C_0), g(G_0). g((unify_with_occurs_check(A,B),unify_with_occurs_check(A,[B|C]),unify_with_occurs_check(C,[B|_]))). skel(unify_with_occurs_check(_,[_|_])). ?- ti(G_0,R_0). G_0 = (unify_with_occurs_check(_A,_B),unify_with_occurs_check(_A,[_B|_C]),unify_with_occurs_check(_C,[_B|_C])), R_0 = (unify_with_occurs_check(_A,[_B|_C]),unify_with_occurs_check(_C,[_B|_C]),unify_with_occurs_check(_A,_B)). ?- ti(G_0,R_0), G_0. false. ?- ti(G_0,R_0), R_0. G_0 = (unify_with_occurs_check([[_A,_A|_B]|_B],[_A|_B]),unify_with_occurs_check([[_A|_B]|_B],[[[_A|_B]|_B]|_B]),unify_with_occurs_check([[_A|_B]|_B],[[[_A|_B]|_B]|_B])), R_0 = G_0, unexpected.And, on a second reading of above it's worse!
?- ti(G_0,_).
G_0 = ( unify_with_occurs_check(_A,_B),
unify_with_occurs_check(_A,[_B|_C]),
unify_with_occurs_check(_C,[_B|_C])), unexpected. % should be a _D
?- ti((_,_,C_0),_).
C_0 = unify_with_occurs_check(C_0,[_A|_B]), unexpected.
Below is the correct interaction with Scryer:
?- ti(G_0,_). G_0 = (unify_with_occurs_check(_A,_B),unify_with_occurs_check(_A,[_B|_C]),unify_with_occurs_check(_C,[_B|_D])). ?- ti(G_0,_),G_0. false. ?- ti(_,R_0),R_0. false. ?- ti((_,_,C_0),_). C_0 = unify_with_occurs_check(_A,[_B|_C]).
?- ti(G_0,_).
G_0 =
(unify_with_occurs_check(_A,_B),unify_with_occurs_check(_A,[_B|_C]),unify_with_occurs_check(_D,[_B|_E])), unexpected.
?- ti((_,B_0,C_0),_).
B_0 = unify_with_occurs_check(_A,[_B|_C]),
C_0 = unify_with_occurs_check(_C,[_B|_D]). % here OK
?- g((A_0,B_0,C_0)).
A_0 = unify_with_occurs_check(_A,_B),
B_0 = unify_with_occurs_check(_A,[_B|_C]),
C_0 = unify_with_occurs_check(_C,[_B|_D]). % perfect
?- g(G_0).
G_0 = ( unify_with_occurs_check(_A,_B),
unify_with_occurs_check(_A,[_B|_C]),
unify_with_occurs_check(_A,[_B|_D])
), unexpected.
?- unify_with_occurs_check(A,[[[]]|A]). loops, unexpected, non_conforming. false. % expected
?- A=[[]|B],B=[[],[]|B],A=B, false. loops, unexpected.
?- dif(A,B),A=[A|A],B=[B|B]. loops, unexpected. ?- A=[A|A],B=[B|B]. loops, unexpected.
?- A=[A|A],B=[A|B], A=B, false. loops, unexpected. ?- A=[A|A],B=[A|B], false. false. % good ?- A=[A|A],B=[A|B]. loops, unexpected. % seems to be a top level problem
?- dif([],A), A = [[]|B]. A = [[]|B], dif([],[[]|B]). ?- dif([],A), A = [[]|_]. A = [[]|_A], .
$ /opt/gupu/new-trealla/tpl -f Trealla Prolog (c) Infradig 2020-2023, v2.19.7 ?- dif([],A),A=[[]|B]. A = [[]|B], dif([],[[]|B]). ?- dif([],A),A=[[]|B], B=[[]|A]. sto, loops, unexpected. % and cannot be interrupted
?- dif([],A), A = [[]|B]. A = [[]|B], dif([],[[]|B]), unexpected. A = [[]|B]. % expected, but not foundFor this the followup is Item#32
?- X=1;X=2. X = 1 ; ... . false.
.tplrc was the initialization file. But now
a suffix .pl, .pro, or .prolog is needed. In other systems like
SICStus it is just .sicstusrc. Also, strace reveals
ulrich@p0:/tmp$ strace -e file /opt/gupu/new-trealla/tpl
execve("/opt/gupu/new-trealla/tpl", ["/opt/gupu/new-trealla/tpl"], [/* 70 vars */]) = 0
...
lstat("/opt/gupu/new-trealla/tpl", {st_mode=S_IFREG|0775, st_size=2431091, ...}) = 0
getcwd("/tmp", 4096) = 5
lstat("/tmp/~", 0x7ffe3ec45bc0) = -1 ENOENT (No such file or directory)
lstat("/home", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/home/ulrich", {st_mode=S_IFDIR|0755, st_size=32768, ...}) = 0
lstat("/home/ulrich/.tplrc.pl", 0x7ffe3ec45bc0) = -1 ENOENT (No such
file or directory)
...
Why is this /tmp/~ looked at?
?- A=[A|A],A=[A]. sto, loops, unexpected. sto, false. % expected, but not obtained
?- -X+ -Y=X+Y. X = -X, Y = X. ?- -X+ -Y=X+Y, dif(X,Y). false.?- dif(X,Y), -X+ -Y=X+Y. X = -X, Y = X, unexpected.?- dif(X,Y), -X=X,-Y=Y. X = -X, Y = X, unexpected.?- dif(X,Y), -X=X.X = -X, dif(_A,_B), unexpected, unsound. % trealla#210X = - - - - - - - - - ..., unexpected. % missing dif/2 X = -X, dif(X,Y). % expected, but not found?- -X=X, dif(X,Y), -Y=Y. X = -X, Y = X, unexpected.?- -X=X, -Y=Y, dif(X,Y). false.
?- nth0(N, [[]|Es], Es), ground(Es). N = 0, Es = [] ; N = 2, Es = [2|2], unexpected ; ... .
?- L=[a|L], must_be(chars,L). error(type_error(character,[a|_1]),must_be/2), unexpected. type_error(list, _). % expected ?- L=[_], must_be(chars,L). error(type_error(character,[_2]),must_be/2), unexpected. instantiation_error. % expected ?- L=[1|L], must_be(chars,L). error(type_error(character,[1|_1]),must_be/2), unexpected. type_error(character,1) | type_error(list,_). % one of both expected
?- number_chars(N,"1 _0"). N = 10, unexpected. % none proposes this syntax_error(_). % expected ?- number_chars(N,"1_ \n000"). error(syntax_error(number),number_chars/2), unexpected. N = 1000. % expectedNote that sensitivity to trailing spaces makes syntax very brittle.
?- must_be(not_less_than_zero,non_integer). error(type_error(type,not_less_than_zero),must_be/2), unexpected. type_error(integer,non_integer). % expected ?- must_be(not_less_than_zero,-1). error(type_error(type,not_less_than_zero),must_be/2), unexpected. domain_error(not_less_than_zero,-1). % expectedAnd, is
type a good name when also domains are accepted?
?- must_be(chars,[non_character]). error(type_error(list,[non_character]),must_be/2), unexpected. type_error(character, non_character). % expected outcome
?- L=[a|L], must_be(chars,L). loops, unexpected. ?- L=[a|L], must_be(list,L). error(type_error(list,[a|_1]),must_be/2). % better, culprit not OK ?- L=[1|L], must_be(chars,L). error(type_error(list,[1|_1]),must_be/2). % fine, but why? ?- L=[a|L], catch(must_be(chars,L), Error, true). L = [a|L], Error = error(type_error(list,[a,a|_A]),must_be/2). % good! Why?Isn't there
'$skip_max_list'/4 in the system? It seems
that there is a lot of highly specialized code in the system. Why is
the list sometimes detected and sometimes not?
?- unify_with_occurs_check(B,[A|B]). false. ?- unify_with_occurs_check(B,[C|C]),unify_with_occurs_check(B,[A|B]). false. ?- dif([],A),unify_with_occurs_check(B,[A|B]). false. ?- dif([],A),unify_with_occurs_check(B,[C|C]),unify_with_occurs_check(B,[A|B]). A = [C|C], B = A, C = A, unexpected. ?- dif([],A),B=[C|C],unify_with_occurs_check(B,[A|B]). A = [C|C], B = A, C = A, unexpected. ?- B=[C|C],unify_with_occurs_check(B,[A|B]). false.
?- dif([],A). dif:dif([],dummyA), unexpected. ?- dif([],A), var(A). dif:dif([],dummyA), unexpected. % but probably a top level issue only.
?- dif(A,B),A=[[]|A],B=[[]|A].A = [[]|A], B = A, unexpected.loops. ?- A=[[]|A],B=[[]|A], dif(A,B). false.
ulrich@p0:/opt/gupu/new-trealla$ ulimit -v 99999 ulrich@p0:/opt/gupu/new-trealla$ ./tpl -f ?- findall(t,(dif([],A),A=[[]|A]),Ts). error(resource_error(finite_memory),top_level/0), unexpected. ?- catch(findall(t,(dif([],A),A=[[]|A]),Ts),Error,true). Error = error(resource_error(finite_memory),top_level/0), unexpected.
ulrich@p0:/opt/gupu/new-trealla$ ulimit -v 99999 ulrich@p0:/opt/gupu/new-trealla$ ./tpl -f ?- length(L, 1000000). error(resource_error(finite_memory),length_rundown/2), unexpected. error(resource_error(memory),length_rundown/2). ?- catch(length(L, 1000000),Error,true). error(resource_error(memory),top_level/0).The resource
finite_memory is here to indicate
that any finite memory would not be enough. But in this
case, a larger size would suffice.