YAP-Prolog: Current Items/All Items

development, old stable, old development, 6.3, gitpatches, files
../configure --prefix /opt/gupu/yap-6.3 --with-gmp --enable-clpbn-bp=false
installation
g1:/opt/gupu/yap-src/Build> cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/gupu/yap ../
310: *
Odd syntax errors with number_chars/2. ?- number_chars(1,[a]). user_input:0:0: error executing prolog:number_chars/2: [ Syntax Error: % Fatal YAP Error: exiting.... Exiting .... % C-Execution stack: ?- catch(number_chars(1,[a]),error(E,_),true). E=syntax_error(), unexpected. ?- catch(number_chars(1,[a]),error(E,_),true), E =.. Es. Es=[syntax_error,], E=syntax_error(), unexpected.
309: * extreme performance differences
SICStus YAP SWI
10.040 0.052 0.694
20.200 0.272 0.809
336.290 24.493 5.560
using a 1000 elements list, a 1000 times.
  1. direct manual recursion
  2. maplist(plus(1),Xs,Ys)
  3. maplist(\X^Y^(Y is X+1),Xs,Ys)
308: * when conditions
 ?- catch(when((nonvar(X),murks),true),error(E,_),true).
freeze(X,when(murks,user:true)).
Expected: E = domain_error(when_condition,(nonvar(_A),murks)) This is particularly necessary to ensure that new conditions are properly handled.
307: * between/3
 ?- between(0,inf,X).
X = 0 ? ;
X = 1 ? 
Expected: type_error(integer,inf).
306: * dif/2 problem
ulrich@p0:/opt/gupu/src/yap-6.3/narch$ ./yap -f
YAP 6.3.4 (x86_64-linux): Sun May 31 21:45:13 CEST 2015
 ?- X = 1.
X = 1.
 ?- dif(X,Y).
dif(X,Y).
 ?- dif(X-Y,1-2).
dif(X-Y,1-2).
 ?- dif(X-Y,1-2), X = Y.
Bus error (core dumped)
ulrich@p0:/opt/gupu/src/yap-6.3/narch$ 

ulrich@p0:/opt/gupu/src/yap-6.3/narch$ echo `date` `git pull && git reset --hard`
Fri Feb 13 18:12:25 CET 2015 Already up-to-date. HEAD is now at 071bb36 fix alignment

ulrich@p0:/opt/gupu/src/yap-6.3/narch$ echo `date` `git pull && git reset --hard`
Mon Feb 9 23:16:22 CET 2015 Already up-to-date. HEAD is now at 888a58b script improvements
305: !! compilation problem
 ==============  packages/myddas
make[1]: Entering directory `/opt/gupu/src/yap-6.3/narch/packages/myddas'
gcc -c -DCOROUTINING=1 -DRATIONAL_TREES=1 -DTABLING=1 -DDEPTH_LIMIT=1 -DMYDDAS_ODBC -shared -fPIC -O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -DCOROUTINING=1 -DRATIONAL_TREES=1 -DTABLING=1 -DDEPTH_LIMIT=1 -DMYDDAS_ODBC  -I../../../packages/myddas -I../.. -I../../../packages/myddas/../../include -I../../../packages/myddas/../../H -I../../../packages/myddas/../../OPTYap -I../../../packages/myddas/../../os ../../../packages/myddas/myddas_util.c -o myddas_util.o
../../../packages/myddas/myddas_util.c:44:1: warning: no previous prototype for ‘myddas_util_connection_type’ [-Wmissing-prototypes]
../../../packages/myddas/myddas_util.c: In function ‘myddas_util_connection_type’:
../../../packages/myddas/myddas_util.c:47:5: warning: implicit declaration of function ‘myddas_util_search_connection’ [-Wimplicit-function-declaration]
../../../packages/myddas/myddas_util.c:47:5: warning: initialization makes pointer from integer without a cast [enabled by default]
../../../packages/myddas/myddas_util.c: At top level:
../../../packages/myddas/myddas_util.c:60:1: warning: no previous prototype for ‘myddas_util_search_predicate’ [-Wmissing-prototypes]
../../../packages/myddas/myddas_util.c:77:1: warning: no previous prototype for ‘myddas_util_add_predicate’ [-Wmissing-prototypes]
../../../packages/myddas/myddas_util.c: In function ‘myddas_util_add_predicate’:
../../../packages/myddas/myddas_util.c:81:5: warning: initialization makes pointer from integer without a cast [enabled by default]
../../../packages/myddas/myddas_util.c:84:5: warning: implicit declaration of function ‘myddas_init_initialize_predicate’ [-Wimplicit-function-declaration]
../../../packages/myddas/myddas_util.c:84:5: warning: initialization makes pointer from integer without a cast [enabled by default]
../../../packages/myddas/myddas_util.c: At top level:
../../../packages/myddas/myddas_util.c:97:1: warning: no previous prototype for ‘myddas_util_delete_predicate’ [-Wmissing-prototypes]
../../../packages/myddas/myddas_util.c:115:1: warning: no previous prototype for ‘myddas_util_delete_connection’ [-Wmissing-prototypes]
../../../packages/myddas/myddas_util.c: In function ‘myddas_util_delete_connection’:
../../../packages/myddas/myddas_util.c:117:38: warning: initialization makes pointer from integer without a cast [enabled by default]
../../../packages/myddas/myddas_util.c: At top level:
../../../packages/myddas/myddas_util.c:147:1: warning: no previous prototype for ‘myddas_util_search_connection’ [-Wmissing-prototypes]
../../../packages/myddas/myddas_util.c:147:1: error: conflicting types for ‘myddas_util_search_connection’
../../../packages/myddas/myddas_util.c:47:5: note: previous implicit declaration of ‘myddas_util_search_connection’ was here
../../../packages/myddas/myddas_util.c:164:1: warning: no previous prototype for ‘myddas_util_add_connection’ [-Wmissing-prototypes]
../../../packages/myddas/myddas_util.c: In function ‘myddas_util_add_connection’:
../../../packages/myddas/myddas_util.c:174:3: warning: implicit declaration of function ‘myddas_init_initialize_connection’ [-Wimplicit-function-declaration]
../../../packages/myddas/myddas_util.c:174:8: warning: assignment makes pointer from integer without a cast [enabled by default]
../../../packages/myddas/myddas_util.c: At top level:
../../../packages/myddas/myddas_util.c:191:1: warning: no previous prototype for ‘myddas_util_get_odbc_enviromment’ [-Wmissing-prototypes]
../../../packages/myddas/myddas_util.c:204:1: warning: no previous prototype for ‘myddas_util_get_total_multi_queries_number’ [-Wmissing-prototypes]
../../../packages/myddas/myddas_util.c:209:1: warning: no previous prototype for ‘myddas_util_set_total_multi_queries_number’ [-Wmissing-prototypes]
../../../packages/myddas/myddas_util.c:331:1: warning: no previous prototype for ‘get_myddas_top’ [-Wmissing-prototypes]
../../../packages/myddas/myddas_util.c:339:1: warning: no previous prototype for ‘myddas_util_get_pred_next’ [-Wmissing-prototypes]
../../../packages/myddas/myddas_util.c:345:1: warning: no previous prototype for ‘myddas_util_get_pred_arity’ [-Wmissing-prototypes]
../../../packages/myddas/myddas_util.c:351:1: warning: no previous prototype for ‘myddas_util_get_pred_name’ [-Wmissing-prototypes]
../../../packages/myddas/myddas_util.c:357:1: warning: no previous prototype for ‘myddas_util_get_pred_module’ [-Wmissing-prototypes]
../../../packages/myddas/myddas_util.c:363:1: warning: no previous prototype for ‘myddas_util_get_list_pred’ [-Wmissing-prototypes]
make[1]: *** [myddas_util.o] Error 1
make[1]: Leaving directory `/opt/gupu/src/yap-6.3/narch/packages/myddas'
make: *** [all] Error 1
ulrich@p0:/opt/gupu/src/yap-6.3/narch$ 
304: * compilation problem
ulrich@p0:/opt/gupu/src/yap-6.3/narch$ git reset --hard
HEAD is now at ba978d8 just in time native code: now compiles by doing cmake; make.
ulrich@p0:/opt/gupu/src/yap-6.3/narch$ make
gcc -c -O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -DCOROUTINING=1 -DRATIONAL_TREES=1 -DTABLING=1 -DDEPTH_LIMIT=1 -DMYDDAS_ODBC -DHAVE_CONFIG_H -D_YAP_NOT_INSTALLED_=1 -DDESTDIR=\"\" -I/usr/local/include  -I. -I../H -I../include  -I../os -I../OPTYap -I../BEAM -I../CXX ../C/absmi.c -o absmi.o
../C/absmi.c: In function ‘Yap_absmi’:
../C/absmi.c:1688:5: error: ‘Yap_ABSMI_ControlLabels’ undeclared (first use in this function)
../C/absmi.c:1688:5: note: each undeclared identifier is reported only once for each function it appears in
../C/absmi.c:1688:31: error: ‘control_labels’ undeclared (first use in this function)
make: *** [absmi.o] Error 1
303: * integers?
 ?- integer(10000000000000000000).
false.
302: * nonconforming strings
 ?- set_prolog_flag(double_quotes,string).
true.
?- write_canonical("abc").
"abc"true.
This is not canonical syntax, because "abc" might be read as chars or codes as well. To make strings a valid extension the canonical syntax would have to use backquoted strings see 6.4.7 Back quoted strings. Then, set_prolog_flag(double_quotes, string) would make sense — as much as chars or codes.
301: * number_chars/2 regressions
There are many differences to 6.2.0, like:
 ?- number_chars(1.0e9,['1',.,'0','E','9']).
false.
 ?- number_chars(1,['0','1']).
false.
 ?- number_chars(1,[a]).
false.
 ?- catch(number_codes(N,0),error(E,_),true).
E = type_error(string,0).
300: * allocation problem
 ?- abs(X) #=< 7^7^7.
*** glibc detected *** /usr/local/bin/yap: realloc(): invalid next size: 0x00000000008b6fa0 ***
299: * current_predicate/1
 ?- current_predicate(abx/1).
error at  clause 2 of prolog:'$get_undefined_pred'/4 !!
INSTANTIATION ERROR- functor/3: expected bound value
Expected: failure.
298: * git describe does not work
ulrich@p0:/opt/gupu/src/yap-6.3$ git describe --tags
fatal: No names found, cannot describe anything.
It used to work.

ulrich@p0:/opt/gupu/src/yap-6.3/narch$ date&& git pull && git reset --hard
Wed Jan 28 02:04:03 CET 2015
Already up-to-date.
HEAD is now at 9f945c1 cmake
297: *
ulrich@p0:~/SO$ /opt/gupu/yap-6.3/bin/yap -f
YAP 6.3.4 (x86_64-linux): Mon Jan 26 00:38:17 CET 2015
 ?- X = 1.
%
%
% YAP OOOPS: tried to access illegal address 0x7f44852a7c10!!!!.
%
%
%
% PC: meta-call
%   Continuation: prolog:catch/3 at clause 1 
Active Choice-Points:
$catch(_1048439,$history:fail,_1048404)
yap_flag(readline,true)
$history:save_history_line(X = 1)
repeat 
$catch(_131086,user:$Error(_131086),_1048524)
repeat 
 
   Exiting ....
296: * installation
ulrich@p0:/opt/gupu/src/yap-6.3/narch$ make
make: *** No rule to make target `JIT/HPP/JIT.hpp', needed by `yap'.  Stop.
"Fix" by manually editing the Makefile. It seems I have only llvm 3.0, but 3.5 would be required.
295: * length/2
 ?- N is 2^64, length([], N).
     ERROR at  clause 1 of prolog:length/2 !!
     TYPE ERROR- length/2: expected integer, got 18446744073709551616

Expected: failure.
294: * Hexadecimal numbers
 ?- X= 0x1000000000000000000000.
X = 0.
Expected: X = 19342813113834066795298816.
293: * installation
ulrich@p0:/opt/gupu/src/yap-6.3/narch$ make 
gcc -c -O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -DCOROUTINING=1 -DRATIONAL_TREES=1 -DTABLING=1 -DDEPTH_LIMIT=1 -DHAVE_CONFIG_H -D_YAP_NOT_INSTALLED_=1 -I/opt/gupu/yap-6.3/include  -I. -I../H -I../include  -I../os -I../OPTYap -I../BEAM ../C/sysbits.c -o sysbits.o
../C/sysbits.c: In function 'p_yap_paths':
../C/sysbits.c:2862:14: error: 'DESTDIR' undeclared (first use in this function)
../C/sysbits.c:2862:14: note: each undeclared identifier is reported only once for each function it appears in
../C/sysbits.c:2863:46: error: expected ')' before string constant
../C/sysbits.c:2864:46: error: expected ')' before string constant
../C/sysbits.c:2865:46: error: expected ')' before string constant
292: *! escaped quote
 ?- atom_codes(A,"'").
A = '\''.
Above is fine, but:
?- writeq('\'').
|: 
     ERROR!!
     error(syntax_error(end_of_file_in_string),stream(user_input,2,0,73))
     ERROR!!
     error(syntax_error(end_of_file_in_string),stream(user_input,2,0,73))

Expected (without waiting): '\''. So YAP can write but does not read a single quote.
291: *
 ?- X is 256^2^62.
X = 1.
Expected: Either the correct number or a resource_error. A representation error is not OK.
290: * bad version-number
ulrich@p0:/opt/gupu/src/yap-6.3$ date;git pull;git describe --tags;date
Mon Feb 24 12:16:24 CET 2014
Already up-to-date.
6.3.2-1447-gb8ebc87
Mon Feb 24 12:16:25 CET 2014
Expected: The current version is 6.3.4, so also git should know this
289: * writing (-)/2
Please update from writing - (1)^2 to - (1^2). (see #43) From -a^b to - (a^b). So if the principal functor is a prefix minus and the argument is an infix or postfix, always put brackets. See 7.10.5. It's the only way to implement this with low effort in Prolog directly. Otherwise an extra state or difference is needed.
288: * variable_names/1 differences
Finally, all details seem to have been settled. See: #7 and following.
ulrich@p0:/opt/gupu/src/yap-6.3/narch$ date && git pull && git describe --tags
Wed Feb 19 18:27:12 CET 2014
Already up-to-date.
6.3.2-1447-g1e8d70a
287: * [ISO] missing silent failure
 ?- arg(1000000000000000000,s(_),_).
false.
 ?- arg(10000000000000000000,s(_),_).
     ERROR!!
     TYPE ERROR- arg 1 of arg/3: expected integer, got 10000000000000000000
286: * documentation
Deprecate C-Prolog specfic file I/O. That is, tell/0 etc.
285: * library(clpfd) problem
ulrich@p0:/opt/gupu/src/yap-6.3$ narch/yap -f
YAP 6.3.4 (x86_64-linux): Wed Dec 11 16:30:35 CET 2013
MYDDAS version MYDDAS-0.9.1
 ?- use_module(library(clpfd)).
 % reconsulting /opt/gupu/yap-6.3/share/Yap/clpfd.pl...
     ERROR [ Thread 0 ] at  clause 1 of prolog:'$$compile'/4 !!
     PERMISSION ERROR- in line 160, system predicate string/1: modifying static procedure string/1
  % reconsulting /opt/gupu/yap-6.3/share/Yap/assoc.yap...
   % reconsulting /opt/gupu/yap-6.3/share/Yap/rbtrees.yap...
   % reconsulted /opt/gupu/yap-6.3/share/Yap/rbtrees.yap in module rbtrees, 24 msec 293712 bytes
  % reconsulted /opt/gupu/yap-6.3/share/Yap/assoc.yap in module assoc, 28 msec 335648 bytes
  % reconsulting /opt/gupu/yap-6.3/share/Yap/pairs.pl...
  % reconsulted /opt/gupu/yap-6.3/share/Yap/pairs.pl in module pairs, 0 msec 17904 bytes
% Warning: [Thread 0 ]
% Discontiguous definition of clpfd:goal_expansion/2.
% Warning: [Thread 0 ]
% Discontiguous definition of clpfd:attr_unify_hook/2.
% Warning: [Thread 0 ]
% Discontiguous definition of clpfd:attribute_goals/3.
% Warning: [Thread 0 ]
% Discontiguous definition of clpfd:attr_unify_hook/2.
% Warning: [Thread 0 ]
% Discontiguous definition of clpfd:attribute_goals/3.
% Warning: [Thread 0 ]
% Discontiguous definition of clpfd:attr_unify_hook/2.
% Warning: [Thread 0 ]
% Discontiguous definition of clpfd:attribute_goals/3.
% Warning: [Thread 0 ]
% Discontiguous definition of clpfd:attr_unify_hook/2.
% Warning: [Thread 0 ]
% Discontiguous definition of clpfd:attribute_goals/3.
% Warning: [Thread 0 ]
% Discontiguous definition of clpfd:attr_unify_hook/2.
% Warning: [Thread 0 ]
% Discontiguous definition of clpfd:attribute_goals/3.
% Warning: [Thread 0 ]
% Discontiguous definition of clpfd:attr_unify_hook/2.
 % reconsulted /opt/gupu/yap-6.3/share/Yap/clpfd.pl in module clpfd, 272 msec 2800624 bytes
true.
284: *
 ?- _=..[1|_].
     ERROR!!
     TYPE ERROR- (=..)/2: expected atom, got 1
 ?- a=..[a|a].
false.
Expected: instantiation_error, and type_error(list,[a|a])
283: * bad toplevel
 ?- call( (true->B=true;B=false) ).
B = true.
 ?- (true->B=true;B=false).
B = true ? ;
B = false.
Expected: same as with call/1.
282: * term_variables/3
First, I am not that sure that term_variables/3 should exist at all accessible to the user — it is fine if the compiler can detect such cases and insert it internally. But regardless of this:
 ?- term_variables([A],[A,B],[B]).
true.
 ?- term_variables([A],[A,B],Vs).
false.
Expected: Vs = [B].
281: * installation problems
for p in ../../../packages/swi-minisat2/examples/adder.pl ../../../packages/swi-minisat2/examples/pearl_examples.pl; do /usr/bin/install -c -m 644 $p /opt/gupu/yap-6.3/share/doc/Yap/packages/examples/minisat; done
make[1]: Leaving directory `/opt/gupu/src/yap-6.3/narch/packages/swi-minisat2'
(cd LGPL ; make install)
make[1]: Entering directory `/opt/gupu/src/yap-6.3/narch/LGPL'
make[1]: *** No rule to make target `../../LGPL/base64.pl', needed by `install'.  Stop.
make[1]: Leaving directory `/opt/gupu/src/yap-6.3/narch/LGPL'
make: *** [install_copied_files] Error 2
ulrich@p0:/opt/gupu/src/yap-6.3/narch$ history|tail -4
  515  history
  516  make clean && make -j 2
  517  make install
  518  history|tail -4
ulrich@p0:/opt/gupu/src/yap-6.3/narch$ git describe --tags
6.3.2-723-gb88dcb8
280: * variable_names/1
 ?- write_term(A,[variable_names(['Leftmost'=A,'Middlemost'=A,'Rightmost'=A])]).
false.
Expected: Leftmost: Minerva, SWI, GNU, B.
279: * typo
ulrich@p0:/opt/gupu/src/yap-6.3$ git grep infite
docs/yap.tex:Succeeds if there are loops in the term @var{T}, that is, it is an infite term.
278: * variable_names/1 wakes up constraints
g1:/opt/gupu/src/yap-6.3/narch>     yap -f
YAP 6.3.4 (x86_64-linux): Tue Jan 29 12:39:29 CET 2013
MYDDAS version MYDDAS-0.9.1
 ?- write_term(This is Nice,[variable_names(['This'=This,'Nice'=Nice])]).
This is  Nice
true
 ?- freeze(X,(nl,write(f(X)),nl)), write_term(X,[variable_names(['Iggs'=X])]).
_D131992
f(Iggs)
freeze(X,user: (nl,write(f(X)),nl))
Expected: Write out only Iggs. Evidently, attributed variables are not detected as variables and their bindings wake up the constraint. It should not wake up the constraints. The motivation is that handling attributed variables/constraints is extremely implementation dependent - we would never get agreement on this. But it is very simple for all implementations to just ignore constraints for the time of writing. This is one step towards a portable toplevel.
277: * installation problem
g1:/opt/gupu/src/yap-6.3/narch> git describe --tags
6.3.2-696-gdbd4c7f
g1:/opt/gupu/src/yap-6.3/narch> make
gcc -O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -DMYDDAS_ODBC -DCOROUTINING=1 -DCUT_C=1 -DRATIONAL_TREES=1 -DDEPTH_LIMIT=1 -DTABLING=1 -DHAVE_CONFIG_H -D_YAP_NOT_INSTALLED_=1 -I/opt/gupu/include  -I. -I../H -I../include  -I../os -I../OPTYap -I../BEAM -I../MYDDAS -rdynamic  -L/opt/gupu/lib -L/opt/gupu/src/yap-6.3/narch -Wl,-R/opt/gupu/lib -Wl,-R,/opt/gupu/lib/Yap -o yap yap.o libYap.a -lodbc -lgmp -lreadline -lncurses -lresolv -lnss_dns -lnss_files -lcrypt -lstdc++ -lm  -ldl -lnsl 
libYap.a(c_interface.o): In function `YAP_signal':
/opt/gupu/src/yap-6.3/narch/../C/c_interface.c:3884: undefined reference to `Yap_signal'
libYap.a(absmi.o): In function `Yap_absmi':
/opt/gupu/src/yap-6.3/narch/../C/absmi.c:11451: undefined reference to `Yap_undo_signal'
libYap.a(adtdefs.o): In function `LookupWideAtom':
/opt/gupu/src/yap-6.3/narch/../C/adtdefs.c:275: undefined reference to `Yap_signal'
libYap.a(adtdefs.o): In function `LookupAtom':
/opt/gupu/src/yap-6.3/narch/../C/adtdefs.c:208: undefined reference to `Yap_signal'
libYap.a(attvar.o): In function `AddToQueue':
/opt/gupu/src/yap-6.3/narch/../C/attvar.c:50: undefined reference to `Yap_signal'
libYap.a(attvar.o): In function `AddFailToQueue':
/opt/gupu/src/yap-6.3/narch/../C/attvar.c:66: undefined reference to `Yap_signal'
libYap.a(errors.o): In function `Yap_Error':
/opt/gupu/src/yap-6.3/narch/../C/errors.c:492: undefined reference to `Yap_signal'
libYap.a(exec.o):/opt/gupu/src/yap-6.3/narch/../C/exec.c:644: more undefined references to `Yap_signal' follow
libYap.a(inlines.o): In function `p_dif':
/opt/gupu/src/yap-6.3/narch/../C/inlines.c:430: undefined reference to `Yap_undo_signal'
libYap.a(stdpreds.o): In function `Yap_InitCPreds':
/opt/gupu/src/yap-6.3/narch/../C/stdpreds.c:4289: undefined reference to `Yap_InitSignalCPreds'
libYap.a(sysbits.o): In function `HandleVTALRM':
/opt/gupu/src/yap-6.3/narch/../C/sysbits.c:1770: undefined reference to `Yap_signal'
libYap.a(sysbits.o): In function `HandleALRM':
/opt/gupu/src/yap-6.3/narch/../C/sysbits.c:1752: undefined reference to `Yap_signal'
libYap.a(sysbits.o): In function `InteractSIGINT':
/opt/gupu/src/yap-6.3/narch/../C/sysbits.c:1637: undefined reference to `Yap_signal'
/opt/gupu/src/yap-6.3/narch/../C/sysbits.c:1650: undefined reference to `Yap_signal'
/opt/gupu/src/yap-6.3/narch/../C/sysbits.c:1659: undefined reference to `Yap_signal'
libYap.a(sysbits.o):/opt/gupu/src/yap-6.3/narch/../C/sysbits.c:1646: more undefined references to `Yap_signal' follow
collect2: ld returned 1 exit status
make: *** [yap] Error 1
276: * YAP slower than SWI
here is such a case!! It is slower by almost a factor of two for:
?- 1000=I,time(( between(1,I,X), between(1,I,Y), X \== Y, false )).
275: * GMP memory
?- 7^8^9>0.
     ERROR!!
     RESOURCE ERROR- not enough stack
SWI handles this easily.
274: * typo
it is an fite term/a finite
273: * documentation
commit 237976cf309a0b706d4b0c2668126c639003d866
Author: Vítor Santos Costa 
Date:   Tue Oct 2 15:15:16 2012 +0100
cyclic_term is **not** ISO ; the current documentation claims it to be ISO. I can only recommend to remove cyclic_term/1 altogether - it will only create less portable code. Every useless extension makes Prolog weaker.
272: * last case for length/2
?- length(1,L).
     ERROR!!
     TYPE ERROR- length(1,_131101): expected list, got 1
Expected: Failure
271: * Prolog prologue
How to provide the Prolog prologue in YAP?
270: * length/2 differences
Please refer to this comparison. BTW, also SICStus did change here!
269: * Removing invalid escapes
SWI recently removed many of the invalid escape sequences. Consider to remove them too: #11, #193, #12, #21, #211, #104, #105, #126.
268: * Syntax regressions
In the table, those entries are marked "reg":
#18, #38, #179, #39, #40, #100, #108, #130, #126. only one left!
267: * Syntax change:
YAP 6.2.1 (i686-linux): Sat May 28 18:49:06 CEST 2011
   ?- X = 0'\z.
X = 122
   ?- ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6.3/bin/yap -f none
YAP 6.3.2 (i686-linux): Mon Apr 16 02:37:12 CEST 2012
?- X = 0'\z.
X = -1
Expected: Syntax error. There is not a single other system that produces -1. There is one system (Ciao) which produces 122. IF, SWI, B, GNU, SICStus, XSB all produce a syntax error.

This is probably one of Paulo Moura's suggestions. It does not make sense. in_character_code is an explicit type (8.1.2.) and is defined as:

in_character_code — a character code or the integer -1
So the -1 is mentioned explicitly and is therefore hardwired. This was not even part of Quintus.
266: * current_predicate/1
YAP 6.3.2 (i686-linux): Mon Apr 16 02:37:12 CEST 2012
?- current_predicate(P), P = current_predicate/1.
no
?- current_predicate(current_predicate/1).
yes
Expected: failure. SWI is wrong on this.
265: * compilation problem
ulrich@gupu2:/opt/gupu/src/yap-6.3/narch$ git describe --tags
6.3.2-47-g051936c
ulrich@gupu2:/opt/gupu/src/yap-6.3/narch$ make
gcc -DBP_FREE -O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -DCUT_C=1  -DCOROUTINING=1 -DRATIONAL_TREES=1 -DDEPTH_LIMIT=1 -DTABLING=1 -DHAVE_CONFIG_H -D_YAP_NOT_INSTALLED_=1 -I. -I../H -I../include  -I../os -I../OPTYap -I../BEAM -I../MYDDAS -rdynamic  -L/opt/gupu/src/yap-6.3/narch -Wl,-R/opt/gupu/yap-6.3/lib -Wl,-R,/opt/gupu/yap-6.3/lib/Yap -o yap yap.o libYap.a -lgmp -lresolv -lnss_dns -lnss_files -lcrypt -lstdc++ -lm  -lncurses -lreadline -ldl -lnsl 
yap.o: In function `init_standard_system':
/opt/gupu/src/yap-6.3/narch/../console/yap.c:92: undefined reference to `YAP_parse_yap_arguments'
libYap.a(swi.o): In function `PL_initialise':
/opt/gupu/src/yap-6.3/narch/../library/dialect/swi/fli/swi.c:2040: undefined reference to `YAP_parse_yap_arguments'
collect2: ld returned 1 exit status
make: *** [yap] Error 1
The last version that did not have this problem was: 6.3.2-9-gb15c9f5. So the culprit is probably:
commit a9d1bd788e521d6c3a731893fea093cccffb1be8
Author: Vitor Santos Costa 
Date:   Fri Jun 22 03:56:01 2012 -0500

    improve SWI console

Here is the invocation with bp, which does not fix the problem.
config.status:  echo "running CONFIG_SHELL=/bin/bash /bin/bash ../configure " '--prefix' '/opt/gupu/yap-6.3' '--with-gmp' '--enable-clpbn-bp=0' $ac_configure_extra_args " --no-create --no-recursion" >&6
config.status:  exec /bin/bash "../configure" '--prefix' '/opt/gupu/yap-6.3' '--with-gmp' '--enable-clpbn-bp=0' $ac_configure_extra_args --no-create --no-recursion
264: * toplevel problem
?- true ; true.
yes
Expected: Two answers by default. Otherwise you cannot easily detect accidental choice points.
263: * toplevel problem
?- g3:~/iso-prolog> /opt/gupu/yap-6.3/bin/yap -f none
YAP 6.3.2 (x86_64-linux): Thu Jun 21 14:55:50 CEST 2012
?- X = 1 ; false.
X = 1 ? ;

X = 1 ? ;

no
Expected: highlighted answer should not be present.
g3:/opt/gupu/src/yap-6.3/narch-g3> git describe --tags
6.3.2-5-g7b6239c
g3:/opt/gupu/src/yap-6.3/narch-g3> uname -a
Linux g3 2.6.35-22-generic #35-Ubuntu SMP Sat Oct 16 20:45:36 UTC 2010 x86_64 GNU/Linux
262: * better indexing
?- append(Xs,Ys,[]).
Xs = Ys = [] ? ;

no
Expected: Determinate. Same problem for
p(_).
p(2).
And
?- p(1), T = t.
T = t ? ;

no
SWI is determinate for p/1 but not for append/3.

Why this is so relevant: When parsing with DCGs, many cases remain nondeterminate because of similar reasons. Think of:

seq([]) --> [].
seq([E|Es]) --> [E], seq(Es).
?- phrase(seq(Es), []).
261: internal compiler error
make[1]: Entering directory `/opt/gupu/src/yap-6.3/narch/library/tries'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/opt/gupu/src/yap-6.3/narch/library/tries'
(cd packages/CLPBN/clpbn/bp ; make)
make[1]: Entering directory `/opt/gupu/src/yap-6.3/narch/packages/CLPBN/clpbn/bp'
g++ -c -std=c++0x -shared -fPIC -DBP_FREE -O3 -fomit-frame-pointer -Wall    -D_YAP_NOT_INSTALLED_=1 -I../../../../../packages/CLPBN/clpbn/bp -I../../../.. -I../../../../../packages/CLPBN/clpbn/bp/../../../../include  -g -O0 -Wextra ../../../../../packages/CLPBN/clpbn/bp/FactorGraph.cpp -o FactorGraph.o
../../../../../packages/CLPBN/clpbn/bp/FactorGraph.cpp: In member function 'void FactorGraph::readFromUaiFormat(const char*)':
../../../../../packages/CLPBN/clpbn/bp/FactorGraph.cpp:72: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.4/README.Bugs> for instructions.
make[1]: *** [FactorGraph.o] Error 1
make[1]: Leaving directory `/opt/gupu/src/yap-6.3/narch/packages/CLPBN/clpbn/bp'
make: *** [all] Error 2
Solution: Please try --enable-clpbn-bp=false
260: * bad syntax_error regression
?- catch(number_chars(_,[]),error(syntax_error(_),_),true).
     ERROR!!
     SYNTAX ERROR at "", goal number_chars(_131506,[]): expected_number_syntax
Expected: Success due to caught error.

The format of a syntax error is: syntax_error(Atom) and nothing else! If you want to provide further information, you can put it in the second argument of error/2.

259: * member/2
?- use_module(library(lists)).
 % reconsulting /opt/gupu/yap-6.3/share/Yap/lists.yap...
  % reconsulting /opt/gupu/yap-6.3/share/Yap/error.pl...
  % reconsulted /opt/gupu/yap-6.3/share/Yap/error.pl in module error, 0 msec 25096 bytes
 % reconsulted /opt/gupu/yap-6.3/share/Yap/lists.yap in module lists, 4 msec 65720 bytes
yes
?- member(X,[1]).
X = 1 ? ;
 
no
Expected: Determinate.

BTW: Where is member/2 defined? I cannot find it in lists.yap.

258: * inefficient memory management?
?- use_module(library(clpfd)).
yes
?- abs(X) #=< 7^7^7.
     ERROR at  clause 3 of clpfd:cis_uminus/2 !!
     RESOURCE ERROR- not enough stack
?- 7^7^7 #> 0.
yes
SWI handles this easily on the same 32 bit machine.
257: * regression uninstantiation_error
ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6/bin/yap -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP 6.2.1 (i686-linux): Sat May 28 18:49:06 CEST 2011
   ?- catch(open('/etc/passwd',read,r),error(E,_),true).
E = uninstantiation_error(r)
   ?- ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6.3/bin/yap -f none
YAP 6.3.2 (i686-linux): Thu Mar 22 23:29:16 CET 2012
?- catch(open('/etc/passwd',read,r),error(E,_),true).
unimplemented SWI error 18
E = instantiation_error
256: *w writeq/1 almost OK!
There are two things missing:
  1. #150: on the left hand of a associative operator (that is yf and yfx) a right associative operator of same priority needs round brackets. So implementations have to handle that case a little bit differently. E.g. GNU has a flag INSIDE_ANY_OP vs. INSIDE_LEFT_ASSOC_OP for this.
  2. #253 remove the dot operator.
255: *w please remove hack around phrase
that is
+phrase(_:[], S, S) :- !.
+phrase(_:[H|T], S0, S) :- !,
+       lists:append([H|T], S, S0).
and add
[](H,T,Xs0,Xs) :- '.'(H,T,Xs0,Xs).
For the time #254 is open.
?- phrase(C,Xs).
C = Xs = []
Things like that slow down the entire process by months.
254: * call/3... and '.'
?- catch(call(.(H,T),Xs0),error(E,_),true).
E = existence_error(procedure,[]/3)
?- catch(call(.(H,T),Xs0,Xs),error(E,_),true).
E = existence_error(procedure,[]/4)
?- catch(call(.(H,T),Xs0,Xs,_),error(E,_),true).
E = existence_error(procedure,[]/5)
Expected: '.'/3,4,5 in place of []/3,4,5
253: * removing . ?
What about removing
?- current_op(P,xfy,.).
P = 999 ? ;

no
YAP and XSB are the only systems left...
252: * get_char/get_code ISO
?- catch(get_char(df),Pat,true).
|: a
Pat = error(type_error(character,df),context(get_char/1,_A))
Expected: No reading, type in_character
251: * ^C makes clpfd fail
ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6.3/bin/yap -f none
YAP 6.3.2 (i686-linux): Thu Mar 22 23:29:16 CET 2012
?- [user].
 % consulting user_output...
|     :- use_module(library(clpfd)).
  % reconsulting /opt/gupu/yap-6.3/share/Yap/clpfd.pl...
   % reconsulting /opt/gupu/yap-6.3/share/Yap/assoc.yap...
    % reconsulting /opt/gupu/yap-6.3/share/Yap/rbtrees.yap...
    % reconsulted /opt/gupu/yap-6.3/share/Yap/rbtrees.yap in module rbtrees, 12 msec 141368 bytes
   % reconsulted /opt/gupu/yap-6.3/share/Yap/assoc.yap in module assoc, 16 msec 160944 bytes
   % reconsulting /opt/gupu/yap-6.3/share/Yap/pairs.pl...
   % reconsulted /opt/gupu/yap-6.3/share/Yap/pairs.pl in module pairs, 4 msec 9160 bytes
  % reconsulted /opt/gupu/yap-6.3/share/Yap/clpfd.pl in module clpfd, 176 msec 1379016 bytes
|     
| n_factorial(0, 1).
|     n_factorial(N, F) :- N #> 0, N1 #= N - 1, F #= N * F1, n_factorial(N1, F1).
|      % consulted user_output in module user, 184 msec 1403504 bytes
yes
?- X #> Y.
Y#=<X+-1
?- n_factorial(N,0).
^CAction (h for help): a
?- X #> Y.
no
So after ^C clpfd fails
250: * make check problem
lrich@gupu2:/opt/gupu/src/yap-6.3/narch$ make check
gcc -c -DBP_FREE -O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes -g -O2 -DCUT_C=1  -DCOROUTINING=1 -DRATIONAL_TREES=1 -DDEPTH_LIMIT=1 -DTABLING=1 -DHAVE_CONFIG_H -D_YAP_NOT_INSTALLED_=1 -I. -I../H -I../include  -I../os -I../OPTYap -I../BEAM -I../MYDDAS ../os/libtai/check.c -o check.o
gcc -rdynamic  -L/opt/gupu/src/yap-6.3/narch -Wl,-R/opt/gupu/yap-6.3/lib -Wl,-R,/opt/gupu/yap-6.3/lib/Yap  check.o   -o check
check.o: In function `main':
/opt/gupu/src/yap-6.3/narch/../os/libtai/check.c:27: undefined reference to `leapsecs_init'
/opt/gupu/src/yap-6.3/narch/../os/libtai/check.c:31: undefined reference to `caltime_scan'
/opt/gupu/src/yap-6.3/narch/../os/libtai/check.c:34: undefined reference to `caltime_tai'
/opt/gupu/src/yap-6.3/narch/../os/libtai/check.c:35: undefined reference to `caltime_utc'
/opt/gupu/src/yap-6.3/narch/../os/libtai/check.c:36: undefined reference to `tai_pack'
/opt/gupu/src/yap-6.3/narch/../os/libtai/check.c:37: undefined reference to `tai_unpack'
/opt/gupu/src/yap-6.3/narch/../os/libtai/check.c:38: undefined reference to `tai_sub'
/opt/gupu/src/yap-6.3/narch/../os/libtai/check.c:45: undefined reference to `caltime_fmt'
/opt/gupu/src/yap-6.3/narch/../os/libtai/check.c:46: undefined reference to `caltime_fmt'
collect2: ld returned 1 exit status
make: *** [check] Error 1
rm check.o
249: * strange errors with sort
ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6.3/bin/yap -f none
YAP 6.3.2 (i686-linux): Thu Mar 22 23:29:16 CET 2012
?- sort([1,2],X).
no
?- sort(X,L).
     ERROR!!
     INSTANTIATION ERROR- sort(0,_131501): expected bound value
?- sort([],L).
nono
What is happening here?
248: *Pw
?- catch((L=[1|L],sort(L,K)),error(E,_),true).
E = resource_error(stack)
?- L=[1|L], sort([],L).
no
Expected: type_error(list,[1,1,1,1|**]) Patch already sent. Waiting for further action.
?- keysort(X,[]).
no
Expected: instantiation_error For keysort, input and output must be of same lenght.
247: * escape sequences
ISO supports only
control escape sequences: \a \b \r \f \t \n \v
same meaning as in C (ISO/IEC 9899)
meta escape sequences: \\ \' \" \`
meaning the character literally
continuation escape sequence \ newline
meaning the empty word (in quoted, double quoted and back quoted tokens)
octal escape sequence starting with \ decimal digit
hexadecimal escape sequence starting with \x
There are much too many pseudo-escape sequences in YAP - they behave everywhere differently.
246: * ISO documentation
25.3 Compatibility with the ISO Prolog standard needs to be updated. To begin with: What flags are still relevant. It is important that the default setting is ISO. You cannot claim conformance by offering non-ISO by default.
245: * missing type_error(list,...)
?- number_chars(2,[_|1]) ; a =.. [t|1].
no
244: * skip_list error?
?- use_module(library(error)).
 % reconsulting /opt/gupu/yap-6.3/share/Yap/error.pl...
  % reconsulting /opt/gupu/yap-6.3/share/Yap/lists.yap...
  % reconsulted /opt/gupu/yap-6.3/share/Yap/lists.yap in module lists, 4 msec 35472 bytes
 % reconsulted /opt/gupu/yap-6.3/share/Yap/error.pl in module error, 8 msec 65664 bytes
yes
?- must_be(list,Xs).
     ERROR!!
     EXISTENCE ERROR- procedure $skip_list/3 is undefined, called from context  prolog:$command/4
                 Goal was error:$skip_list(_131512,_131513,_131514)
?- ulrich@gupu2:~/iso-prolog$
ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6.3/bin/yap -f none
YAP 6.3.2 (i686-linux): Tue Mar 20 20:24:32 CET 2012
?- use_module(library(clpfd)).
 % reconsulting /opt/gupu/yap-6.3/share/Yap/clpfd.pl...
  % reconsulting /opt/gupu/yap-6.3/share/Yap/assoc.yap...
   % reconsulting /opt/gupu/yap-6.3/share/Yap/rbtrees.yap...
   % reconsulted /opt/gupu/yap-6.3/share/Yap/rbtrees.yap in module rbtrees, 16 msec 141384 bytes
  % reconsulted /opt/gupu/yap-6.3/share/Yap/assoc.yap in module assoc, 20 msec 160968 bytes
  % reconsulting /opt/gupu/yap-6.3/share/Yap/pairs.pl...
  % reconsulted /opt/gupu/yap-6.3/share/Yap/pairs.pl in module pairs, 0 msec 9152 bytes
 % reconsulted /opt/gupu/yap-6.3/share/Yap/clpfd.pl in module clpfd, 180 msec 1383088 bytes
yes
?- sum([1],#=,S).
S = 1
?- sum([X,Y],#=,S).
X+Y#=S
?- sum(Xs,#=,S).
     ERROR!!
     EXISTENCE ERROR- procedure $skip_list/3 is undefined, called from context  prolog:$query/2
                 Goal was error:$skip_list(_131512,_131513,_131514)
Expected: instantiation_error.
243: * default memory limit not OK
Currently, YAP permits by default to use all the virtual memory available. In this manner, a student's laptop (and mine too) starts to crawl if some infinite loop is running accidentally. Please consider to put a reasonable limit. My laptop has 2999196k of memory. (I don't have a labtop ...) And I want to run all kinds of things at the same time together with YAP...
242: * syntax regression
ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6/bin/yap -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP 6.2.1 (i686-linux): Sat May 28 18:49:06 CEST 2011
   ?- writeq({a}).
{a}yes
   ?- ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6.3/bin/yap -f none
YAP 6.3.2 (i686-linux): Wed Mar 14 14:16:44 CET 2012
?- writeq({a}).
{}(a)yes
Expected: {a}. Nitpick: This is a thing where the standard (by ommision) prescribes {}(a) but this is definitely an error, since 6.3.6.1 uses it as an example. It should be handled per analogiam ('.')/2.
241: * (-)/1 space needed
YAP 6.3.2 (i686-linux): Wed Mar 14 14:16:44 CET 2012
?- writeq(-(-1)).
--1yes
Expected: - -1
?- writeq(-(-)).
-(-)yes
Expected: - (-)
?- writeq(-(:-)).
-(:-)yes
Expected: - (:-)
240: * bigger problem
ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6.3/bin/yap -f none
YAP 6.3.2 (i686-linux): Wed Mar 14 14:16:44 CET 2012
?- use_module(library(clpfd)).
 % reconsulting /opt/gupu/yap-6.3/share/Yap/clpfd.pl...
     ERROR!!  (/opt/gupu/yap-6.3/share/Yap/error.pl:166).
     EXISTENCE ERROR- procedure variables_within_term/3 is undefined, called from context  prolog:$full_clause_optimisation/4
                 Goal was terms:variables_within_term([_187728,_187730,_187732],(must_be(integer,_187730),type_error(rational,_187732)),_187727)
     ERROR!!  (/opt/gupu/yap-6.3/share/Yap/maplist.yap:249).
     EXISTENCE ERROR- procedure variables_within_term/3 is undefined, called from context  prolog:$full_clause_optimisation/4
                 Goal was terms:variables_within_term([_195058,_195060,_195062,_195064,_195066,_195068,_195070,_195072],sumnodes_body(_195062,_195064,_195077,_195068,_195060,_195072),_195057)
239: * Bad toplevel answer
?- freeze(X, false).
freeze('$VAR'('X'),user:false)
This is a perfect opportunity to introduce a write-option variable_names/1! See #220. See also #171.
238: * install_info problems
ulrich@gupu2:/opt/gupu/src/yap-6.3/narch$ make install_info
make info; \
	/usr/bin/install -c yap.info* /opt/gupu/yap-6.3/share/info; \
	if test -e /opt/gupu/yap-6.3/share/info/emacs.bz2; then \
	  bzip2 --quiet --force /opt/gupu/yap-6.3/share/info/yap.info*; \
	else \
	  if test -e /opt/gupu/yap-6.3/share/info/emacs.gz; then \
	  gzip --quiet --force /opt/gupu/yap-6.3/share/info/yap.info*; \
	  fi \
	fi; \
	/usr/sbin/install-info --quiet --section "Programming Languages" yap.info /opt/gupu/yap-6.3/share/info/dir; \
	cd ../LGPL/pillow/doc ; \
	/usr/bin/install -c pillow_doc.info /opt/gupu/yap-6.3/share/info; \
	if test -e /opt/gupu/yap-6.3/share/info/emacs.bz2; then \
	  bzip2 --quiet --force /opt/gupu/yap-6.3/share/info/pillow_doc.info; \
	else \
	  if test -e /opt/gupu/yap-6.3/share/info/emacs.gz; then \
	  gzip --quiet --force /opt/gupu/yap-6.3/share/info/pillow_doc.info; \
	  fi \
	fi; \
	/usr/sbin/install-info --quiet --section "Programming Languages" --entry="`cat pillow_doc.infoindex`" --info-dir=/opt/gupu/yap-6.3/share/info pillow_doc.info
make[1]: Entering directory `/opt/gupu/src/yap-6.3/narch'
make[1]: Nothing to be done for `info'.
make[1]: Leaving directory `/opt/gupu/src/yap-6.3/narch'
/usr/bin/install: target `/opt/gupu/yap-6.3/share/info' is not a directory
install-info: warning: don't call programs like install-info with an absolute path,
install-info: warning: /usr/sbin/install-info provided by dpkg is deprecated and will go away soon;
install-info: warning: its replacement lives in /usr/bin/.
This is not dpkg install-info anymore, but GNU install-info
See the man page for ginstall-info for command line arguments
install-info: Not a directory for /opt/gupu/yap-6.3/share/info/dir
install-info: warning: don't call programs like install-info with an absolute path,
install-info: warning: /usr/sbin/install-info provided by dpkg is deprecated and will go away soon;
install-info: warning: its replacement lives in /usr/bin/.
This is not dpkg install-info anymore, but GNU install-info
See the man page for ginstall-info for command line arguments
install-info: Not a directory for /opt/gupu/yap-6.3/share/info/dir
make: *** [install_info] Error 1
ulrich@gupu2:/opt/gupu/src/yap-6.3/narch$ mkdir /opt/gupu/yap-6.3/share/info
237: * null-character bug
?- char_code(C,0),writeq(C).
''C = ''
You have two possibilities here: Either write C = '\0\' or issue a representation_error(character_code). SWI and SICStus 4 write '\000\' and '\x0\'. IF, B, GNU an error. Proceed as you like. (#225)
236: * regression -1
(This is case #182)
?- writeq(-(-1)).
-(-1)yes
Expected: - -1.

Here is a hopefully simple way how to deal with this. What you need is a flag that the last thing written was - as a prefix operator. If this is the case a nonnegative number (with no -) must be written in round brackets. So -(1^2) is written as - (1)^2.

Another way to write this would be - (1^2).

?- writeq(-(2^3)).
-2^3yes
Expected: - (1)^2 or - (1^2).
235: * incorrect toplevel
?- L = _B, length(L,2).
L = [_A,_B]
Expected: L = [_A, _C] or similar.
234: * syntax regression
?- X is 1'+'1.
     ERROR!!
     TYPE ERROR- atom 1 for arithmetic expression: expected evaluable term, got 1
(#130)
233: * syntax regression
?- write_canonical('$VAR'(1)).
Byes
(#145
232: *
Used to be #48
ulrich@gupu2:~/lftp/yap-prolog$ /opt/gupu/yap-6.3/bin/yap  -f none
YAP 6.3.2 (i686-linux): Tue Mar  6 15:46:19 CET 2012
?- [fastunification].
 % consulting /home/tour/yap-prolog/fastunification.pl...
 % consulted /home/tour/yap-prolog/fastunification.pl in module user, 0 msec 12824 bytes
yes
?- test(A).
A = 2^18-8 ? ;
%
%
% YAP OOOPS: tried to access illegal address (nil)!!!!.
%
%
%
% PC: user:t/1 at clause 1 
%   Continuation: user:test/1 at clause 1 
%    4608KB of Global Stack (0xb68b8008--0xb6d38154)
%    0KB of Local Stack (0xb6e21e10--0xb6e22008)
%    0KB of Trail (0xb6e2200c--0xb6e220ac)
%    Performed 7 garbage collections
% All Active Calls and
%         Goals With Alternatives Open  (Global In Use--Local In Use)
%
%         prolog:$$_length1/3 (512KB--0KB)
%  user:test/1 at clause 1 
%  prolog:$query/2 at clause 3 
%  prolog:$command/4 at clause 2 
%  prolog:$enter_top_level/0 at clause 5 
%         prolog:$catch/3 (512KB--0KB)
%  prolog:$system_catch/4 at clause 1 
%  meta-call
 
   Exiting ....
YAP 6.3.2 (i686-linux): Tue Mar 6 15:46:19 CET 2012
231: * no indexing
?- [user].
 % consulting user_output...
|     intertwine([], [], []).
|     intertwine([E|Es], Fs, [E|Gs]) :- intertwine(Es, Fs, Gs).
|     intertwine(Es, [F|Fs], [F|Gs]) :- intertwine(Es, Fs, Gs).
|      % consulted user_output in module user, 4 msec 7136 bytes
yes
?- intertwine([], [], Xs).
Xs = [] ? ;
 
no
Expected: No choice point. Jekejeke is currently the only system avoiding that choice point.
230: * regression
ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6/bin/yap  -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP 6.2.1 (i686-linux): Sat May 28 18:49:06 CEST 2011
   ?- findall(t,fail,1).
     ERROR!!
     TYPE ERROR- findall(t,user:fail,1): expected list, got 1
   ?- halt.
% YAP execution halted
ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6.3/bin/yap  -f none
YAP 6.3.1 (i686-linux): Mon Nov 14 12:58:39 CET 2011
?- findall(t,fail,1).
no
?-
This is so odd, because in the source code you do the checking...
229: * is_list/1
?- L=[_|L],is_list(L).
loops
Expected: failure (that's what '$skip_list'/3 is about).
228: * suggestion
Add C function Yap_IsPartialListOrList with the meaning:
partial_list_or_list(Xs0) :-
	'$skip_list'(_, Xs0,Xs),
	(	Xs == []
	->	true
	;	var(Xs)
	).
This could be used to check the validity of arguments rapidly. E.g. for #198, term_variables/2
YAP_IsListOrPartialListTerm.
227: * syntax deviation
The complete syntax issues are here.
226: * syntax regression
?- X/* /*/=7.
|:      ERROR!!
     error(syntax_error(end_of_file_in_block_comment),stream(user_input,19,1,442))
Expected: X = 7
225: * incorrect toplevel
?- X = (:-).
X = :-
Expected: X = (:-)
224: * incorrect escape syntax
writeq('\033\').
'\033'yes
expected: '\033\'
223: * Syntax regression - operators
Correct in 6.2. Incorrect in 6.3.
ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6/bin/yap -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP 6.2.1 (i686-linux): Sat May 28 18:49:06 CEST 2011
   ?- writeq((*)=(*)).
(*)=(*)yes
   ?- halt.
% YAP execution halted
ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6.3/bin/yap -f none
YAP 6.3.1 (i686-linux): Mon Nov 14 12:58:39 CET 2011
?- writeq((*)=(*)).
* = *yes
?- halt.
% YAP execution halted
222: *w Syntax regression newline
In 6.2 this used to be correct. In 6.3 YAP is now incompatible with SWI, B, GNU, SICStus.
ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6/bin/yap -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP 6.2.1 (i686-linux): Sat May 28 18:49:06 CEST 2011
   ?- writeq('\n').
'\n'yes
   ?- halt.
% YAP execution halted
ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6.3/bin/yap -f none
YAP 6.3.1 (i686-linux): Mon Nov 14 12:58:39 CET 2011
?- writeq('\n').
'
'yes
221: *
  ?- open('/dev/null',read,X), ground(X), atom(X).
X = <stream>(0x83c6b18)

7.10.2.1 reads:

A standard-conforming program shall make no assumptions
about the form of the stream-term, except that:
a) It is a ground term.
b) It is not an atom.
c) It uniquely identifies a particular stream during the
time that the stream is open.
It is implementation dependent whether or not the pro-
cessor uses the same stream-term to represent different
source/sinks at different times.
220: *
missing write option variable_names/1
There is a read option but not the corresponding write option. Without this option there is no way to write out variable names. That is, the top level has to display variables either by some internal name, or by using a non-standard feature like changing the meaning of '$VAR'. The standard defines '$VAR'(X) only for the non-negative integers. All other terms must be printed out literally with the $VAR around. SWI, YAP, SICStus, B, XSB do something nonconforming. And they all do it differently. And it cannot be fixed at all in the presence of constraints. That's why this variable_names/1 option is so important!

This is how Minerva does it:

?- Opts = [variable_names(_)],read_term(X,Opts), write_term(X,Opts).
f(This is Nice).
f(This is Nice)
Opts	= [variable_names(['This' = _1735,'Nice' = _1809])]
X	= f(_1735 is _1809) 

And this is how Jekejeke does it:

?- Opts = [variable_names(_)],read_term(X,Opts), write_term(X,Opts).
f(This is Nice).
f(This is Nice)Opts = [variable_names(['This' = _E, 'Nice' = _F])],
X = f(_E is _F)

And this is how GNU does it:

GNU Prolog 1.4.1
By Daniel Diaz
Copyright (C) 1999-2012 Daniel Diaz
| ?- Opts = [variable_names(_)],read_term(X,Opts), write_term(X,Opts).
f(This is Nice).
f(This is Nice)

Opts = [variable_names(['This'=A,'Nice'=B])]
X = f(A is B)
219: * interrupts
Interrupts are now less stable.
ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6.3/bin/yap  -f none
YAP 6.3.1 (i686-linux): Mon Nov 14 12:58:39 CET 2011
?- length(L,L).
^CAction (h for help): a
no
?- length(L,L).
^CAction (h for help): a
Illegal instruction
git clone git://yap.git.sourceforge.net/gitroot/yap/yap-6.3
218: * space leak?
ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6/bin/yap
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP 6.2.0 (i686-linux): Sun Apr  3 22:28:54 CEST 2011
 % reconsulting /home/ulrich/.yaprc...
  % reconsulting /opt/gupu/yap-6/share/Yap/timeout.yap...
   % reconsulting /opt/gupu/yap-6/share/Yap/hacks.yap...
   % reconsulted /opt/gupu/yap-6/share/Yap/hacks.yap in module yap_hacks, 0 msec 4096 bytes
  % reconsulted /opt/gupu/yap-6/share/Yap/timeout.yap in module timeout, 0 msec 7136 bytes
  % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl...
   % reconsulting /opt/gupu/yap-6/share/Yap/assoc.yap...
    % reconsulting /opt/gupu/yap-6/share/Yap/rbtrees.yap...
    % reconsulted /opt/gupu/yap-6/share/Yap/rbtrees.yap in module rbtrees, 12 msec 138376 bytes
   % reconsulted /opt/gupu/yap-6/share/Yap/assoc.yap in module assoc, 20 msec 156944 bytes
   % reconsulting /opt/gupu/yap-6/share/Yap/pairs.pl...
   % reconsulted /opt/gupu/yap-6/share/Yap/pairs.pl in module pairs, 0 msec 8928 bytes
  % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 180 msec 1411792 bytes
  % reconsulting /opt/gupu/yap-6/share/Yap/lambda.pl...
  % reconsulted /opt/gupu/yap-6/share/Yap/lambda.pl in module lambda, 0 msec 20232 bytes
  % reconsulting /home/ulrich/ftp/yap-prolog/library/uwnutil.pl...
  % reconsulted /home/ulrich/ftp/yap-prolog/library/uwnutil.pl in module uwnutil, 0 msec 18728 bytes
 % reconsulted /home/ulrich/.yaprc in module user, 180 msec 1487848 bytes
   ?- statistics.
memory (total)        5521404 bytes
   program space      4096000 bytes:    2770360 in use,      1325640 free
                                                                   0  max
   stack space        1228800 bytes:     525532 in use,       703268 free
     global stack:                       525140 in use,       527356  max
      local stack:                          392 in use,         3732  max
   trail stack         196604 bytes:         36 in use,       196568 free
 
       0.000 sec. for 0 code, 0 stack, and 0 trail space overflows
       0.000 sec. for 0 garbage collections which collected 0 bytes
       0.000 sec. for 0 atom garbage collections which collected 0 bytes
       0.184 sec. runtime
       0.184 sec. cputime
       0.004 sec. systime
       6.717 sec. elapsed time
 
yes
   ?- length(Cs,I),maplist(\C^member(C,".1e-+ "),Cs), catch(number_chars(N,Cs),error(syntax_error(E),_),false),I=8.
Cs = [49,46,49,49,49,49,49,49],
I = 8,
N = 1.111111 ? 
yes
   ?- statistics.
memory (total)       22036476 bytes
   program space     20611072 bytes:   13176496 in use,      7434576 free
                                                                   0  max
   stack space        1228800 bytes:     525532 in use,       703268 free
     global stack:                       525140 in use,       530580  max
      local stack:                          392 in use,         3732  max
   trail stack         196604 bytes:         36 in use,       196568 free
 
       0.004 sec. for 6 code, 0 stack, and 0 trail space overflows
       0.000 sec. for 0 garbage collections which collected 0 bytes
       0.032 sec. for 3 atom garbage collections which collected 3570134 bytes
       7.944 sec. runtime
       7.948 sec. cputime
       0.020 sec. systime
      40.116 sec. elapsed time
 
yes
217: * error strange
   ?- X is 0 div 0.
     ERROR!!
     ZERO DIVISOR ERROR- X is div 0
This just looks strange.
216: * better version number
A more precise version number is needed. SWI displays the "git number" for intermediary versions.
215: * clpfd
Better way to keep library(clpfd) up-to-date.
214: wf same_term/2 needed
Under this or another name like test_toplevel_equal/2, prolog:'$eq'/2 or similar. Ideally, under the name '$neq'/2 for not equal. With the help of such a BIP, YAP could have rapid detection of cycles. This is what I use in SICStus 3:
'$skip_list'(N, Xs0,Xs) :-
	(	nonvar(Xs0), Xs0 = [_|Xs1]
	->	'$skip_list_b'(Xs0,Xs1,Xs, Xs0, 1,0,N)
	;	N = 0, Xs0 = Xs
	).

'$skip_list_b'(Xs0,Xs1,Xs, S1, P0,La0, N) :-
	(	P0 == La0
	->	P1 is P0<<1,
		La1 = 1,
		S2 = Xs0
	;	P1 = P0,
		La1 is La0 + 1,
		S2 = S1
	),
	(	nonvar(Xs1),
		Xs1 = [_|Xs2],
		\+ prolog:'$eq'(Xs1,S2)
	->	'$skip_list_b'(Xs1,Xs2,Xs, S2, P1,La1, N)
	;	N is P1+La1-1, Xs1 = Xs
	).
(Writing this in C would be even better, but I fail to understand the C-code conventions in YAP). With the help of this '$skip_list'/3, setof/3 would be terminating for L=[t|L],setof(t,true,L).by using:
'$partial_list_or_list'(Xs0) :-
	'$skip_list'(_, Xs0,Xs),
	(	Xs == []
	->	true
	;	var(Xs)
	).
213: * write_canonical([a]).
Should write '.'(a,[]). Thus, list syntax is disabled. IF, SWI, B, GNU, SICStus, Ciao do it that way. If you want to write a term that can be read back regardless of operator declarations but with []-syntax, simply switch off the operators.
212: * writeq/1
   ?- writeq(-(1)).
-1
Expected: - (1) if prefix operator present. Otherwise -(1). That is a bit strange, but if an operator is a prefix operator then this has to be shown by writeq/1.
211: * git down
ulrich@gupu2:/opt/gupu/src/yap-6$ date ; git pull ; date
Thu Jan  6 11:47:14 CET 2011
yap.dcc.fc.up.pt[0: 193.136.27.114]: errno=Connection timed out
fatal: unable to connect a socket (Connection timed out)
Thu Jan  6 11:50:24 CET 2011
210: * SWI compatibility
This is a general Christmas-wish: Please pay attention to what is adopted from SWI. Not everything is ISO. By adopting non-ISO stuff (that is, things that are specified differently within ISO and that cannot be considered as an implementation specific extension according to 5), you are multiplying the effort for stability in the long term.
209: f
   ?- set_prolog_flag(strict_iso, on).
yes
   ?- X is 1.0E1.
     SYNTAX ERROR at user, near line 4:
 X is []
<==== HERE ====>
 11.
Expected: X = 10.0. The E is valid in strict mode. But it is not a good idea to have a strict mode flag - except that mode would realise 5.1e completely. (I did send a patch on this, but since patches get commented out, I better concentrate on reporting.)
208: * default mode/values
ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6/bin/yap -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP 6.2.0 (i686-linux): Fri Oct 29 15:47:45 CEST 2010
   ?- current_prolog_flag(unknown,V).
V = fail ?
Expected: error
207: * floats printing incorrect
   ?- length(_,I),X is acos(0.9 ** I), number_chars(X,Chrs), number_chars(Y,Chrs), X \== Y.
Chrs = ['0','.','4','5','1','0','2','7'],
I = 1,
X = 0.451026811796262,
Y = 0.451027 ?

Expected: Infinite loop.
206: f atom_to_term/3 leaks
And thus no serious testing of syntax is possible in YAP.
ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6/bin/yap -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP 6.2.0 (i686-linux): Fri Oct 29 15:47:45 CEST 2010
   ?- repeat, catch(atom_to_term(')',T,Vs),error(syntax_error(_),_),fail).
     ERROR at  clause 1 of prolog:atom_to_term/3 !!
     RESOURCE ERROR- could not find a free stream
Expected: Infinite loop.
205: w! writeq/1
Waiting for patch inclusion or other action. YAP is the only system doing this. IF, SWI, B, GNU, SICStus, Minerva, XSB, Ciao all quote an atom starting with /*.
   ?- write_canonical('/*').
/*yes
   ?- writeq('/*').
/*yes
Expected: quoting.

History: Patch was included, but later removed by:

commit 907d10128d7e6ff26f86a3f0e4bf0919e629a84f
Author: Paulo Moura <pmoura@logtalk.org>
Date:   Tue Nov 23 00:12:41 2010 +0000
 
    Commented out buggy patch for supporting quote atoms starting with /* as it breaks write_canonical/1.
204: * read/1 bad error
   ?- catch(read(X),error(E,_),true).
   |: 1 1.
E = syntax_error(syntax_error(read(_A),between(21,22,5),'\n   <====HERE====>  \n',[number(1)-21,number(1)-22],1,22,user)) ? 
yes
   ?- 
The argument of syntax_error must be an atom. Further information can be provided in the second argument of error/2.
203: * inefficient checking
'$check_list_for_bags'(V, _) :- var(V), !.
'$check_list_for_bags'([], _) :- !.
'$check_list_for_bags'([_|B], T) :- !,
	'$check_list_for_bags'(B,T).
'$check_list_for_bags'(S, T) :-
	'$do_error'(type_error(list,S),T).
Should use '$skip_list'/3 (which is not yet present in YAP).
202: *P setof/3, findall/3
   ?- catch(setof(t,fail,[t|2]),error(E,_),true).
E = type_error(list,2) ? 
yes
   ?- catch(findall(t,fail,[t|2]),error(E,_),true).
E = type_error(list,2) ? ;
Expected: [t|2].
201: * no canonical syntax
Currently, YAP lacks syntax that can be read independently of the operator declarations.
ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6/bin/yap -f
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP 6.2.0 (i686-linux): Fri Oct 29 15:47:45 CEST 2010
   ?- write_canonical(f(-1)).
f(-1)yes
   ?- op(0,fy,-).
yes
   ?- write_canonical(f(-1)).
     SYNTAX ERROR at user, near line 3:
 write_canonical( f( -
<==== HERE ====>
 1 ) ).
Expected: same as above.
200: * Wrong op declaration
  -rw-r--r--  1 ulrich ulrich     595 2010-11-04 14:34 0001-Change-to-fy-DTC2.patch
199: * Toplevel: too many questions
   ?- X  = 1.
X = 1 ? ;
no
Expected: no interactive question - there is no choicepoint open! Most users will not enter the ; and thus will miss cases where things go astray. Take
length(L,N), N = 0.
198: * term_variables/2 missing error
   ?- term_variables(Vars, term(X)).
no
Expected type_error(list,term(XC)). This is a very frequent beginner error. Of course most beginners are quite ashamed to concede it. And: Well, maybe not complete beginners (they will not use it), but lets say - oh well - they are still beginners. Also
   ?- Xs = [a|Xs], term_variables(T, Xs).
no
should produce a type_error(list,[a|...]). Easy with the help of '$skip_list'/3.
197: * '$skip_list'/3 needed
'$skip_list'(Skipped, Xs0, Xs) succeeds, if Xs unifies with the rest of Xs0 which skips Skipped elements. Either use Floyd or even Brent
196: * too permissive syntax
?- X*Y = * * * .
X = Y = * ? 
yes
Expected: syntax error. If a name is used not as an operator it must be bracketed. Again a source of much chagrin. IF, GNU and h do this right.

   ?- [:- -x] = [(:- -x)].
no
Expected: syntax error. This is the source of many problems. As long as systems do not enforce this, users get hit one-by-one. Their common conclusion is that Prolog is cursed and they give up. (In the meantime SWI rejects this in ISO mode, but since this is not the default, nobody uses it.).
195: * incorrect printing
   ?- X = (*) * (*) .
X = * *(*) ?
Expected:
X = (*)*(*) ?
BTW: GNU, h, Minerva, SWI , do this right.
194: f number_chars/2 and co.
There are many cases where YAP differs. It seems the best way to implement them is as follows (pseudocode, assumes the presence of a string type - might be an internal buffer):
number/atom_chars/codes(Number,Chars) :-
   ( nonvar(Number), \+ number(Number) -> throw(error(type_error(number, Number),_)) ; true ),
   scan_chars_to_string(Chars, String), % produces *only* type and representation errors
                                        % but not instantiation errors
   ( var(String)
   -> ( var(Number) -> throw(error(instantiation_error,_)) ; number_to_chars(Number,Chars) )
   ;  parse_string_into_number(String, Numberx), % produces syntax errors
      Numberx = Number
   ).
A few cases are still open.
193: * op/3
It is not possible to change operator '|'. It should be possible to do so within the constraints: infix, and above 1000.
192: * bug in operator declarations
   ?- op(10,fx,[[a]]).
%
%
% YAP OOOPS: tried to access illegal address 0x4f1046a7!!!!.
%
%
191: *Now resource errors Arithmetics incorrect
   ?- 7^7^7 < 7^7^7+1.
no
Expected: success.
190: A cut and call
ulrich@gupu2:/opt/gupu/src/yap-6/narch$ /opt/gupu/yap-6/bin/yap -f
% Restoring file /opt/gupu/src/yap-6/narch/startup.yss
YAP 6.0.7 (i686-linux): Sat Sep  4 22:33:20 CEST 2010
   ?- [user].
 % consulting user_input...
| p1 :- ( var(X), X=!, X, fail ; true ).
| 
| p2 :- call(( var(X), X=!, X, fail ; true )).
| 
 % consulted user_input in module user, 0 msec 5240 bytes
yes
   ?- p1.
yes
   ?- p2.
no
Expected yes in both cases.
189: * operator restrictions missing
   ?- op(1,fx,',').
yes
Expected: permission_error(modify, operator, ',')

There are more restrictions, see the other new errors in DTC2

188: *
   ?- catch(X is-1**1.5,error(E,_),true).
X = (nan) ? 
Expected: E = evaluation_error(undefined)
187: * strange message
   ?- number_chars(1,[1]).
     SYNTAX ERROR at "#x0001;", goal number_chars(1,[1]): expected_number_syntax
186: * atom_chars/2
   ?- Xs=[a|Xs],atom_chars(A,Xs).
Loops and eats memory. Expected: type_error(list,[a| ...]).
185: * superfluous operator
  ?- current_op(Pri,Fix,xor).
Fix = yfx,
Pri = 400 ? ;
no
Expected: Failure. It is really better not to define this as an operator. Every name declared as operator makes Prolog syntax more unstable for two reasons: The precedence is not intuitive, so extra round brackets are needed anyway. Extra brackets are needed for a term like [xor-a]. I.e. [(xor)-a].
184: * acos/1, asin/1
   ?- catch(X is acos(2),error(E,_),true).
E = domain_error(out_of_range,2) ? 
Expected: evaluation_error(undefined). Same for asin/1. If you want to transmit more information, you would need to add this in the second argument of error/2.
183: * xor/2 missing
>< is gone. It is now (functor-only) xor/2.
   ?- X is xor(2,3).
     ERROR!!
     TYPE ERROR- functor xor/2 for arithmetic expression: expected evaluable term, got 2 xor 3/2
182: * gitourious: git objects too large
I cannot use gitorious anymore, it seems that all interesting changes are "too large". Like this.
181: * (div)/2 incorrect
   ?- X is -1 div 2.
X = 0 ? 
yes
   ?- X is floor(-1/2).
X = -1 ? ;
no
   ?- X is truncate(-1/2).
X = 0 ? ;
no
(div)/2 shall use the same rounding function as (mod)/2 does and that is floor/1 and not truncate/1 (as (//)/2 and (rem)/2 do).
180: * incorrect flag value
   ?- X is -1 mod 3.
X = 2 ? ;
no
   ?- X is -1 rem 3.
X = -1 ? 
yes
   ?- current_prolog_flag(integer_rounding_function,X).
X = down ? ;
no
   ?- 
Expected X = toward_zero. (mod)/2 is correct. And (rem)/2 behaves differently (and correctly too!). If the Prolog flag integer_rounding_function (7.11.1.4) is down, the Integer division rounding function (9.1.3.1) called rndI(x) is equal to ⌊x⌋ and that would means that (rem)/2 should be defined in exactly the same way as (mod)/2 is defined.

In other words: integer_rounding_function with value down simply does not make sense as it makes (rem)/2 and (mod)/2 the same function, as well as (//)/2 and (div)/2. Don't ask, why it is here. It was there even in the first draft (N92 of 1992). All systems I know of, implement (//)/2 like toward_zero/2.

179: * Wrong error argument
   ?- catch(X is foo-77,Pat,true).
Pat = error(type_error(evaluable,foo),['atom foo for arithmetic expression'|local_sp(268636712,268789140,[],[])]) ? 
yes
Expected:
Pat = error(type_error(evaluable,foo/0), ...
178: * Big number printing
   ?- X is 7^7^7.
2343 ? 1751580402966282378932933502849310357073612870132
yes
 
   ?- X is 7^7^7.
...
32343 ? 20286961175158040296628237893293350284931035707361287013
yes
Expected
...
X = 3759...0132343.
Below are the WG17 Edinburgh changes
177: * uninstantiation_error(Culprit)
to replace representation_error(variable) or type_error(variable, Culprit). Details.
   ?- catch(open(f,read,x),Pat, true).
Pat = error(type_error(variable,x),[open(f,read,x)|local_sp(open(f,read,x),268788916,[],[])]) ? ;
no
Expected: error(uninstantiation_error(x), ...)
176: * Add div/2
175: * Remove atan/2
atan2/2 is enough.
174: * Add as built-in (no library) acyclic_term/1
173: * Add as built-in (no library) subsumes_term/2
Same as subsumes_chk/2. Definition (I only cursorly checked YAP, but seems ok).
172: @ op/3
Produce a permission_error(create, operator, Op) for
  1. Op == '[]'
  2. Op == '{}'
  3. Op == ('|'), Fix \== xfx, Fix \== xfy, Fix \== yfx thus no infix.
  4. Op == ('|'), Priority < 1001
Above are the WG17 Edinburgh changes
171: *! Answer constraints incomplete
This used to work - in contrast to SWI! We discussed this briefly in Edinburgh: SWI has a problem with displaying hidden constraints.
   ?- freeze(X, false).
freeze(X,user:false) ? ;
no
   ?- \ freeze(X, false).

true ? ;
no
170: * occurs_check flag missing
169: * setof/3 bug
   ?- X = s(X), setof(t,X=X,Ts).
((loops))
Expected: Ts = [t].
168: * setof/3 bug
SWI:
?- setof(t,findall(t,true,[t],[]),[t]).
true.
YAP:
   ?- setof(t,findall(t,true,[t],[]),[t]).
no
167: *A Wrong meta call
 ?- call(((C=!;C=true), C)).
C = !.
Expected: Two solutions.
166: * Operator declaration does not work
ulrich@gupu2:~/iso-prolog$ /opt/gupu/yap-6/bin/yap  -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version 6.0.4
   ?- op(100,xfx,[[]]).
%
%
% YAP OOOPS: tried to access illegal address 0x22101ae4!!!!.
%
%
1132KB of Code Space (0x10000000--0x1011b210)
%
% PC: prolog:$op2/3 at clause 2 
%   Continuation: prolog:$opl/4 at clause 2 
%    512KB of Global Stack (0x1012e000--0x101ae0dc)
%    0KB of Local Stack (0x101f5e5c--0x101f6000)
%    0KB of Trail (0x101f6004--0x101f601c)
%    Performed 0 garbage collections
% All Active Calls and
%         Goals With Alternatives Open  (Global In Use--Local In Use)
%
%  prolog:$opl/4 at clause 2 
%  prolog:$do_yes_no/2 at clause 2 
%  prolog:$yes_no/2 at clause 1 
%  prolog:$command/4 at clause 2 
%  prolog:$enter_top_level/0 at clause 6 
%         prolog:$catch/3 (512KB--0KB)
%  prolog:$system_catch/4 at clause 1 
%  meta-call
 
   Exiting ....
165: * syntax too permissible
If the operator '|' changes, list syntax is destroyed:
   ?- op(10,xfy,'|').
yes
   ?- X = [a|b|c].
X = [a '|' b '|' c] ? 
yes
   ?- X = [a|b].
X = [a '|' b] ? 
Expected: List syntax must never be affected by operator declarations. Thus [a|b] is always the same regardless of declarations for '|', a, b!
164: * exception/3 renaming
in IF/Prolog this is called
[user] ?- exception_handler(arg(a,f(1),_), error(type_error(_,_),_), fail).
Permitting an arbitrary goal. Not clear what the context of exception/3 is, but that might make it more general...
163: * git tip: avoid Merge branch
By making a git rebase prior to pushing, many otherwise useless merges can be avoided. There are situation where merging is needed, thus a merge in the log should be rather something strange that merits attention.
162: * import in all modules
How can I import a module into all modules (without modifying source indeed)? Some functionality in that direction is needed.
161: * no memory??
   ?- X is 7^7^7.
     ERROR!!
     RESOURCE ERROR- not enough stack
   ?- 
This works in SWI out-of-the-box.
160: * error term for setup_call_cleanup/3
Please consider not to include setup_call_catcher_cleanup/4 in the error messages. This highly suggests to use this construct and their are inherent ambiguities that lead to more problems than they solve. Also your reason is wrong anyway. We have some users of that in SWI and most naturally they tap into the problems. One had to concede that it would have been better not to have that extra information from the outset...
   ?- setup_call_catcher_cleanup(true,repeat, C,write(c(C))), throw(xx).
c(fail)     ERROR!!
159: * module thing?
ulrich@gupu2:/opt/gupu/src/yap-6/narch$ /opt/gupu/yap-6/bin/yap -f none
% Restoring file /opt/gupu/src/yap-6/narch/startup.yss
YAP version 6.0.0
   ?- setup_call_cleanup(true, X=true,X).
     ERROR!!
     PERMISSION ERROR- use_module(ypp): cannot read from ypp
158: * hidden state
ulrich@gupu2:/opt/gupu/src/yap-6/narch$ /opt/gupu/yap-6/bin/yap 
% Restoring file /opt/gupu/src/yap-6/narch/startup.yss
YAP version 6.0.0
 % reconsulting /home/ulrich/.yaprc...
  % reconsulting /opt/gupu/yap-6/share/Yap/timeout.yap...
   % reconsulting /opt/gupu/yap-6/share/Yap/hacks.yap...
   % reconsulted /opt/gupu/yap-6/share/Yap/hacks.yap in module yap_hacks, 0 msec 4080 bytes
  % reconsulted /opt/gupu/yap-6/share/Yap/timeout.yap in module timeout, 0 msec 7216 bytes
  % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl...
  % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 108 msec 830888 bytes
  % reconsulting /home/ulrich/ftp/Prolog-inedit/lambda.pl...
     ERROR!!  (/home/ulrich/ftp/Prolog-inedit/lambda.pl:96).
     PERMISSION ERROR- in line 96, system predicate ^/3: modifying static procedure (^)/3
     ERROR!!  (/home/ulrich/ftp/Prolog-inedit/lambda.pl:98).
     PERMISSION ERROR- in line 98, system predicate ^/4: modifying static procedure (^)/4
  % reconsulted /home/ulrich/ftp/Prolog-inedit/lambda.pl in module lambda, 4 msec 22304 bytes
  % reconsulting /home/ulrich/ftp/yap-prolog/library/uwnutil.pl...
  % reconsulted /home/ulrich/ftp/yap-prolog/library/uwnutil.pl in module uwnutil, 0 msec 17888 bytes
 % reconsulted /home/ulrich/.yaprc in module user, 112 msec 900264 bytes
   ?- write_canonical((1;2|3;4)).
'|'(;(1,2),;(3,4))yes
   ?- maplist(1,Xs,Ys,Zs).
Xs = Ys = Zs = [] ? ;
     ERROR at  clause 1 of prolog:call/4 !!
     TYPE ERROR- call/1: expected callable goal, got maplist:user:1
   ?- maplist(1,Xs,Ys,Zs).
Xs = Ys = Zs = [] ? 
yes
   ?- setup_call_cleanup(true, X=true,X).
     ERROR!!
     INSTANTIATION ERROR- setup_call_catcher_cleanup(user:true,user:(_131279=true),_131270,user:_131279): expected bound value
   ?- setup_call_cleanup(true, (X=1;X=2), write(a)), setup_call_cleanup(true,(Y=1;Y=2),write(b)), !.
X = Y = 1 ? ;
no
   ?- setup_call_cleanup(true, (X=1;X=2), write(a)), setup_call_cleanup(true,(Y=1;Y=2),write(b)), !.
X = Y = 1 ? ;
no
   ?- ulrich@gupu2:/opt/gupu/src/yap-6/narch$
Expected: The cleanups should write.
157: * maplist/N-family missing
YAP has only in one library only maplist/3! That is so 1970s! SWI has additionally maplist/2, maplist/4, maplist/5. Update: YAP has it too, but in another library.
156: * parser problem
   ?- current_op(Pri,Fix, '|').
Fix = xfy,
Pri = 1105 ? ;
no
   ?- current_op(Pri,Fix, ;).
Fix = xfy,
Pri = 1100 ? ;
no
   ?- write_canonical((1;2|3;4)).
;(1,'|'(2,;(3,4)))yes
Expected: '|'(;(1,2),;(3,4)).
155: *
   ?- setup_call_cleanup(S=1,(G=2;G=3,throw(x)),write(S+G)).
G = 2,
S = 1 ? ;
1+_1312781+_131278     ERROR!!
     UNHANDLED EXCEPTION - message x unknown
Expected: only one +
154: !* setup_call_cleanup/3 open cases
   ?- setup_call_cleanup(true, X=true,X).
X = true ? 
Expected: Instantiation error prior to calling Goal.
153: * ambiguous case
   ?- setup_call_cleanup(true, (X=1;X=2), write(a)), setup_call_cleanup(true,(Y=1;Y=2),write(b)), !.
abX = Y = 1 ? 
According to current draft, it should be ba - but this might be a case which is currently overspecified.
Update: currently nothing is written!
152: !f zombie constraints
(claimed to be fixed, but not fixed)
ulrich@gupu2:/opt/gupu/src/yap-6/narch$ /opt/gupu/yap-6/bin/yap -f none
% Restoring file /opt/gupu/src/yap-6/narch/startup.yss
YAP version 6.0.0
   ?- use_module(library(clpfd)).
 % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl...
 % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 108 msec 828720 bytes
yes
   ?- X in 1..2, p(X).
     ERROR!!
     EXISTENCE ERROR- procedure p/1 is undefined, called from context  prolog:$enter_top_level/0
                 Goal was user:p(_D195)
   ?- current_op(Pri,Fix,'|').
Fix = xfy,
Pri = 1100,
_A in 1..2 ? 
That problem was already present some time ago...
Now: (2009-11-27)
   ?- current_op(Pri,Fix,'|').
Fix = xfy,
Pri = 1105,
_A in 1..2,
_B in 1..2 ?
151: * Missing cleanups:
   ?-  setup_call_cleanup(true, (X=1;X=2), write(a)), setup_call_cleanup(true,(Y=1;Y=2),write(b)), throw(x).
b     ERROR!!
     UNHANDLED EXCEPTION - message x unknown
Expected: output ba then error x. See 7.8.11.1 c
c) The cleanup handler is called exactly once; no later than upon failure of G. Earlier moments are ...
And also d for the exact order:
Several cleanup goals triggered simultaneously are executed in reversed order of installation.
150: * syntax harmonization
   ?- X = (+) + (+) .
X = (+)+ + ? 
This is invalid Prolog text. Expected: (+). It's ok to be permissive when reading text, but when writing terms, the standard should be obeyed to guarantee portability of generated text between different systems. Change in SWI.
149: * operator harmonization
   ?- current_op(Pri,Fix,'|').
Fix = xfy,
Pri = 1100 ? ;
no
Expected:
?- current_op(Pri,Fix,'|').
Pri = 1105,
Fix = xfy ;
false.
This makes CHR and other commit-like uses of '|' possible. Usual uses of | in DCGs should not be affected by it. See for context information. In general SWI is much too permissive in syntax. But
148: * unclear error
ulrich@gupu2:/opt/gupu/src/yap-6/narch$ /opt/gupu/yap-6/bin/yap  -f none
% Restoring file /opt/gupu/src/yap-6/narch/startup.yss
YAP version 6.0.0
   ?- use_module(library(clpfd)).
 % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl...
 % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 96 msec 830528 bytes
yes
   ?- X in 1..2, p(X).
%
%
% YAP OOOPS: tried to access illegal address (nil)!!!!.
%
%
2244KB of Code Space (0x10000000--0x102311f0)
%
% PC: prolog:print_message/2 at clause 3 
%   Continuation: prolog:$LoopError/2 at clause 2 
%    4352KB of Global Stack (0x1031e2e8--0x1075e36c)
%    -1698452KB of Local Stack (0x107622e8--0xa8cbd000)
%    0KB of Trail (0xa8cbd004--0xa8cbd044)
%    Performed 1 garbage collections
% All Active Calls and
%         Goals With Alternatives Open  (Global In Use--Local In Use)
%
%  prolog:$LoopError/2 at clause 2 
%  prolog:$LoopError/2 at clause 2 
%  meta-call
 
   Exiting ....
ulrich@gupu2:/opt/gupu/src/yap-6/narch$ 
147: * eof_action/1 ignored
   ?- open('/dev/null',read,S,[eof_action(error)]), stream_property(S,eof_action(Action)), get_code(S, C1), get_code(S,C2).
Action = eof_code,
C1 = C2 = -1,
S =H '$stream'(3) ? 
yes
146: * subsumes/2 differences
   ?- subsumes(X, f(X)).
X = f(f(**)) ? ;
   ?- subsumes(g(X), g(f(X))).
X = f(f(**)) ? 
yes
According to Pasadena resolution this should fail! SICStus 3 succeeds for the first but fails for the second. SWI fails for both (as specified).
145: w* Waiting for comments
(since Tue Oct 13 11:37:51 2009)
144: w* unapplied patches
here. Is it no longer of interest to send patches?
  -rw-r--r-- 1 ulrich ulrich  885 2009-10-04 00:00 0001-typo.patch.sent
  -rw-r--r-- 1 ulrich ulrich  850 2009-10-04 00:00 0002-Doc-Corrected-ISO-status.patch.sent
  -rw-r--r-- 1 ulrich ulrich  983 2009-10-04 00:49 0003-Doc-ISO-status-added.patch.sent
143: * Missing type error callable
   ?- setup_call_cleanup(true,throw(x),1).
     ERROR!!
     UNHANDLED EXCEPTION - message x unknown
   ?- 1.
     ERROR!!
     TYPE ERROR- meta_call((?-1)): expected callable goal, got 1
   ?- 
Expected: A type error callable prior to calling the Goal.
142: t Multiple setup_call_cleanup/3
g3:/opt/gupu/src/yap-6/arch> git describe && yap-6 -f none
Yap-6.0.0.0-266-g40ea33c
% Restoring file /opt/gupu/src/yap-6/arch/startup.yss
YAP version Yap-6.0.0
   ?- setup_call_cleanup(true, (X=1;X=2), write(a)), setup_call_cleanup(true,(Y=1;Y=2),write(b)), throw(x).
%
%
% YAP OOOPS: tried to access illegal address 0x10!!!!.
%
%
2056KB of Code Space (0x2000000--0x22021b0)
%
% PC: prolog:$clean_call/2 at clause 1
%   Continuation: prolog:$execute_frozen_goals/1 at clause 2
%    1024KB of Global Stack (0x225c000--0x235c180)
%    0KB of Local Stack (0x23ebd78--0x23ec000)
%    0KB of Trail (0x23ec008--0x23ec148)
%    Performed 0 garbage collections
% All Active Calls and
%         Goals With Alternatives Open  (Global In Use--Local In Use)
%
%  prolog:$execute_frozen_goals/1 at clause 2
%  prolog:$execute_frozen_goals/1 at clause 2
%  prolog:$wake_up_goal/2 at clause 1
%         prolog:$handle_throw/3 (1024KB--0KB)
%  prolog:$query/2 at clause 4
 
   Exiting ....
g3> uname -a
Linux g3 2.6.18perfctr #1 SMP Fri May 4 16:10:13 CEST 2007 x86_64 GNU/Linux
Still here: 2009-09-17 Yap-6.0.0.0-279-g8bde2a0
Still here: 2009-10-28 Yap-6.0.0.0-332-g4c8eb33 Changed 2009-11-20 03:35:10 (CET Fri)
141: * once/1 for setup_call_cleanup/3 needed
This is a simplification that came up at the Pasadena meeting.
 g3:~> yap-6 -f none -G5000
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
   ?- setup_call_cleanup((X=1;X=2),true,true).
X = 1 ? ;
X = 2 ? ;
no
140: *: module optimization
(Ideaonly) Meta-arguments must not be accessed directly (as yesterday..). I.e. No direct unifcation at all. The only way to get rid of this, is via strip_module - or a similar predicate. Also, strip_module must be executed such that aliasing is avoided (e.g. immediately after the head). Maybe strip_module is not good enough, as officially also the "calling context" must be provided to satisfy 13211-2.
139: * unreadable syntax
   ?- [user].
| ax :- ( b -> c ; d -> e ; f ).
| yes
% debug
   ?- listing(ax).
ax :-
   ( b ->
     c
   ;
     ( d ->
       e
     )
   ;
     f
   ).
yes
SWI makes
ax :-
        (   b
        ->  c
        ;   d
        ->  e
        ;   f
        ).
I understand you have a different convention, but the inner parentheses are superfluous.
138: *!! trace/runtime inconsistency
I believe that trace is right wrong, because
  1. the failure after the exception is not ok
  2. there should be no exception
/home/ulrich/lftp/yap-prolog $ yap-6 -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
   ?- [item138].
 % consulting /home/tour/yap-prolog/item138.pl...
 % consulted /home/tour/yap-prolog/item138.pl in module user, 0 msec 1472 bytes
yes
   ?- trace.
% Trace mode on.
yes
% trace
   ?- \1^2.
          (1)    call:\1^2 ? 
          (2)    call:copy_term_nat(1^2,_131193) ? 
          (2)    exit:copy_term_nat(1^2,1^2) ? 
          (3)    call:no_hat_call(user:1^2) ? 
          (4)    call:write(user:1^2) ? 
user:1^2          (4)    exit:write(user:1^2) ? 
          (5)    call:nl ? 

          (5)    exit:nl ? 
          (6)    call:throw(error(representation_error(lambda_parameters),_131661)) ? 
     ERROR!!
     error(representation_error(lambda_parameters),'')
          (6)    exception:throw(error(representation_error(lambda_parameters),_131661)) ? 
          (3)    redo:no_hat_call(user:1^2) ? 
          (3)    fail:no_hat_call(user:1^2) ? 
          (1)    redo:\1^2 ? 
          (1)    fail:\1^2 ? 
no
% trace
   ?- 
   | notrace.
          (1)    call:notrace ? 
% Debug mode off.
          (1)    exit:notrace ? 
yes
% debug
   ?- \1^2.
          (1)    call:\1^2 ? a
% YAP execution aborted
   ?- notrace.
% Debug mode off.
yes
   ?- \1^2.
user:user:1^2
user:user:1^2
Claim to be fixed - too difficult to do now
137: t incorrect debugger syntax
The first prefix is incorrect and ignores the fact that there is an infix operator =!
          (5)    exit: lambda:nl ?
          (6)    call: lambda:lambda:1^2=_131589:_131590 ?
          (6)    exit: lambda:lambda:1^2=lambda:1^2 ?
136: *l copy_term_nat/2
Should be fast for: ?- copy_term_nat(Bigterm^Extra,Bigterm^Copia).I.e. an ideal copy_term does not only copy fast and sharingly, but also would read the second argument in order to detect identity. The traditional approach copies cleverly into a free variable, but performs the remaining as naive unification.
135: * git-describe banner needed
   ?- [ulrich@gupu item133]$ yap-6 -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
it should read:
YAP version Yap-6.0.0.0-160-ga22f66a
134: *: module(library(apply)) problems
[ulrich@gupu item133]$ pl -f none
Welcome to SWI-Prolog (Multi-threaded, 32 bits, Version 5.7.10)
Copyright (c) 1990-2009 University of Amsterdam.
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.
 
For help, use ?- help(Topic). or ?- apropos(Word).
 
?- use_module(nihil).
%   library(error) compiled into error 0.01 sec, 10,060 bytes
%  library(apply) compiled into apply 0.01 sec, 16,400 bytes
% nihil compiled into nihil 0.01 sec, 17,120 bytes
true.
 
?-
% halt
[ulrich@gupu item133]$ yap-6 -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
   ?- use_module(nihil).
 % reconsulting /home/tour/yap-prolog/item133/nihil.pl...
  % reconsulting /opt/gupu/yap-6/share/Yap/apply.yap...
   % reconsulting /opt/gupu/yap-6/share/Yap/apply_macros.yap...
    % reconsulting /opt/gupu/yap-6/share/Yap/maplist.yap...
     % reconsulting /opt/gupu/yap-6/share/Yap/error.pl...
      % reconsulting /opt/gupu/yap-6/share/Yap/lists.yap...
      % reconsulted /opt/gupu/yap-6/share/Yap/lists.yap in module lists, 10 msec 15552 bytes
     % reconsulted /opt/gupu/yap-6/share/Yap/error.pl in module error, 20 msec 32656 bytes
    % reconsulted /opt/gupu/yap-6/share/Yap/maplist.yap in module maplist, 40 msec 49968 bytes
    % reconsulting /opt/gupu/yap-6/share/Yap/expand_macros.yap...
     % reconsulting /opt/gupu/yap-6/share/Yap/charsio.yap...
     % reconsulted /opt/gupu/yap-6/share/Yap/charsio.yap in module charsio, 10 msec 5904 bytes
     % reconsulting /opt/gupu/yap-6/share/Yap/occurs.yap...
      % reconsulting /opt/gupu/yap-6/share/Yap/arg.yap...
      % reconsulted /opt/gupu/yap-6/share/Yap/arg.yap in module arg, 10 msec 2584 bytes
     % reconsulted /opt/gupu/yap-6/share/Yap/occurs.yap in module occurs, 10 msec 6792 bytes
    % reconsulted /opt/gupu/yap-6/share/Yap/expand_macros.yap in module expand_macros, 50 msec 61688 bytes
   % reconsulted /opt/gupu/yap-6/share/Yap/apply_macros.yap in module apply_macros, 90 msec 122704 bytes
     ERROR!!  (/opt/gupu/yap-6/share/Yap/apply.yap:32).
     DOMAIN ERROR- reexport(library(apply_macros),[maplist/3,include/3,exclude/3,partition/4,partition/5]): maplist/3 not a valid element for module_reexport_predicates
  % reconsulted /opt/gupu/yap-6/share/Yap/apply.yap in module apply, 90 msec 134048 bytes
 % reconsulted /home/tour/yap-prolog/item133/nihil.pl in module nihil, 90 msec 135032 bytes
yes
   ?-
This problem must be recent. A version of 2009-05-04 does not have this problem. (unfortunatly binaries do not have a better banner...)
133: f maplist problem
get this tar file, unpack it and make it - this is strange and stateful:
[ulrich@gupu item133]$ make
**** 2vitor: first, the difference between the inputs:
diff inputa.txt inputb.txt
2a3,4
> maplist(_+_, Xs).
>
make: [diff] Error 1 (ignored)
**** 2vitor: now, the good input
yap-6 -f none < inputa.txt
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/tour/yap-prolog/item133/clpfd.pl...
 % reconsulted /home/tour/yap-prolog/item133/clpfd.pl in module clpfd, 180 msec 337216 bytes
yes
 % reconsulting /home/tour/yap-prolog/item133/uwnutil.pl...
 % reconsulted /home/tour/yap-prolog/item133/uwnutil.pl in module uwnutil, 0 msec 1904 bytes
yes
Xs = [] ?
Xs = [_A],
dif(_A,X) ?
yes
**** 2vitor: and now the bad input, there is only one additional line
yap-6 -f none < inputb.txt
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/tour/yap-prolog/item133/clpfd.pl...
 % reconsulted /home/tour/yap-prolog/item133/clpfd.pl in module clpfd, 190 msec 337216 bytes
yes
 % reconsulting /home/tour/yap-prolog/item133/uwnutil.pl...
 % reconsulted /home/tour/yap-prolog/item133/uwnutil.pl in module uwnutil, 0 msec 1904 bytes
yes
Xs = [] ?
yes
Xs = [] ?
     ERROR!!
     EXISTENCE ERROR- procedure dif/3 is undefined, called from context  prolog:$command/4
                 Goal was user:dif(_131452,_131453,_131453)
132: use_module/1: strange side effect
By default, YAP does not know maplist/2. But if I load a library that itself uses maplist, it becomes defined for me. It should not do so. Either it is always present (as in SWI), or only when I tell it to do so.
[ulrich@gupu yap-prolog]$ yap-6 -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
   ?- set_prolog_flag(unknown,error).
yes
   ?- maplist(=(X),Xs).
     ERROR!!
     EXISTENCE ERROR- procedure maplist/2 is undefined, called from context  prolog:$enter_top_level/0
                 Goal was user:maplist(=(_131211),_131209)
   ?- use_module(library(clpfd)).
 % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl...
 % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 410 msec 815432 bytes
yes
   ?- maplist(=(X),Xs).
Xs = [] ?
131: missing local operators?
[ulrich@gupu yap-prolog]$ yap-6 -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
   ?- current_op(A,xfx,cis_lt).
 
no
   ?- use_module(library(clpfd)).
 % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl...
 % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 400 msec 815880 bytes
yes
   ?-  current_op(A,xfx,cis_lt).
A = 700 ? yes
   ?-
Expected: Also the last goal should fail.
Yap-6.0.0.0-158-g3ae6f58
130: * installation problem on t1000
more detail
  647  /tmp/gupu/src/git-1.6.3.2/git  clone git://yap.dcc.fc.up.pt/yap-6
  648  cd yap-6/
  649  ls
  650  mkdir t100
  651  mkdir t1000
  652  cd t1000
  653  ../configure --prefix /tmp/gupu/yap-6 --with-gmp --enable-couroutining
  654  gmake
  655  gmake -j40
  656  gmake
  657  history
bash-3.00$ gmake
gcc -c -O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes -DCOROUTINING=1 -DRATIONAL_TREES=1 -DDEPTH_LIMIT=1 -DHAVE_CONFIG_H -I. -I../H -I../OPTYap -I../BEAM -I../packages/MYDDAS ../C/exec.c -o exec.o
../C/exec.c: In function 'clean_trail':
../C/exec.c:1498: error: 'HBREG' undeclared (first use in this function)
../C/exec.c:1498: error: (Each undeclared identifier is reported only once
../C/exec.c:1498: error: for each function it appears in.)
gmake: *** [exec.o] Error 1
129: * CUDA
could be interesting home, doc
128: J nb_setval meta_predicate?
In SICStus, there is `bb_put(:KEY, +TERM)'.
127: * avoiding nesting
What is the best way to avoid nesting of time_out? I tried to look at the value the virtual timer gave back...
126: * timeouts
Sometimes I get:
   ?- length(_,N),time_out((between(1,100,_),open('/dev/null',read,S),call_cleanup(true,close(S)),false),100,F), time_out((between(1,100),fail),10,FX).
Action (h for help): a
Action (h for help): a
     ERROR!!
     INSTANTIATION ERROR- close(_128): expected bound value
But also:
   ?- length(_,N),time_out((between(1,100,_),open('/dev/null',read,S),call_cleanup(true,close(S)),false),100,F), time_out((between(1,100),fail),10,FX).
Action (h for help): a
% ERROR WITHIN ERROR: tried to access illegal address 0x4200!!!!
186.480u 43.230s 4:16.04 89.7%  0+0k 0+0io 477pf+0w
   ?- length(_,N),time_out((between(1,100,_),open('/dev/null',read,S),call_cleanup(true,close(S)),false),100,F), time_out((between(1,100),fail),10,FX).
Action (h for help): a
%
%
% YAP OOOPS: tried to access illegal address 0x8!!!!.
%
%
1972KB of Code Space (0x2000000--0x21ed1e0)
%
% PC: prolog:$execute_woken_system_goal/1 at clause 1
%   Continuation: prolog:$execute_woken_system_goal/1 at clause 1
%    518KB of Global Stack (0x221e000--0x229f848)
%    1KB of Local Stack (0x22e5b00--0x22e6000)
%    0KB of Trail (0x22e6004--0x22e60d4)
%    Performed 0 garbage collections
% All Active Calls and
%         Goals With Alternatives Open  (Global In Use--Local In Use)
%
 
   Exiting ....
125: * gc event needed
Something like :- on_signal('prolog:gc', _, pio:my_gc).
This is needed for pure output. pio:my_gc should be called prior to performing the actual GC.
124: *! segmentation fault while loading
( echo 'use_module(library(clpfd)).';echo 'load_foreign_files([plstream], [], initIO).' )| yap-6 -f
Segmentation fault
on gupu and g3
Yap-6.0.0.0-138-g7ffbfdb
123: *D syntax extension
Yap, SWI, SICStus all have some implementation specific extension to permit the solo character "head tail separator char" (6.5.3) as infix operator. It seems that Yap accepts the subset of SWI, that is also accepted by SICStus. However, the terms are compatible with SWI and not SICStus.
Prolog text YAP SWI SICStus
Default operators
(a|b). '|'(a,b). '|'(a,b). ;(a,b).
f(a|b). error f('|'(a,b)). error
f(a|b,c). error f('|'(a,b),c). error
f((a|b)). f('|'(a,b)). f('|'(a,b)). f(;(a,b))
f(|). error f('|'). error
f((|)). error f('|'). error
'|'. '|'. '|'. '|'.
[|]. error ['|']. error
[a|b|c]. error [a|'|'(b,c)]. error
[a|b,c]. error [a|','(b,c)]. error
(1;2|3;4). ;(1,'|'(2,;(3,4))). '|'(;(1, 2), ;(3, 4)). ;(1,;(2,;(3,4))).
current_op(A,xfy,'|'). A = 1100. A = 1105. no
current_op(A,xfy,;). A = 1100. A = 1100. A = 1100.
With op(0,xfy,'|'), op(1100,fx,'|'), op(0,xfy,;), op(1100,fx,;).
|1. error '|'(1). error
'|'1. '|'(1). '|'(1). '|'(1).
||. error '|'('|'). error
;1. ;(1). ;(1). ;(1).
;;. ;(;). ;(;). ;(;).
So it seems, that | is permitted in a very restricted context.
122: *D call_cleanup/2 instantiation error missing
This is certainly a rather ambiguous case. But it seems to be still safer to issue an instantiation error
    ?- call_cleanup(length(L,N),C).
L = [],
N = 0
In SICStus 3 there is:
| ?- call_cleanup(length(L,N),C).
! Instantiation error in argument 2 of call_cleanup/2
! goal:  call_cleanup(user:length(_79,_80),user:_77)
On the other hand:
| ?- call_cleanup(length(L,N),(C,C)).
L = [],
N = 0 ?
The motivation for the instantiation error is: We will get the instantiation error every time determinacy cannot be detected (i.e. every time in an imperfect implementation). It is therefore safer to issue the error in advance. There are cases where this is too eager, but those cases will always depend on the effectiveness to remove choice points. It will thus depend on an implementation dependent feature never discussed in 13211-1. (i.e., there is the notion of choicepoint which is sometimes created and sometimes not, but there is no provision for a mechanism for implicit removal - as performed by indexing) E.g.
   ?- call_cleanup(C = true, C).
C = true ? ;
no
On a less efficient, but otherwise completely complying implementation this would be executed as
   ?- call_cleanup(( C = true ; false ), C).
C = true ? ;
     ERROR at  clause 1 of prolog:'$clean_call'/2 !!
     INSTANTIATION ERROR- call/1: expected bound value
Clearly, such problems are difficult to locate - if they only occur at the end.
121: * stack trace missing
SWI offers for C-c interrupts also g: goals. I do not use procedural debuggers. But this one is very useful to know where the computation is hanging.
120: * missing warning for wrong meta-predicate declaration
:- meta_predicate p/1.
Should produce a warning. (The warning can only be caused by p - after all this could be a meta_predicate declaration for a predicate (/)/2.
119: * Doc: module primitives does not exist
...System predicates belong to the module @code{primitives}...
118: Aft clpfd looping (was #80)
[ulrich@gupu ~]$ yap-6
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
  % reconsulting /opt/gupu/yap-6/share/Yap/timeout.yap...
   % reconsulting /opt/gupu/yap-6/share/Yap/hacks.yap...
   % reconsulted /opt/gupu/yap-6/share/Yap/hacks.yap in module yap_hacks, 0 msec 4080 bytes
  % reconsulted /opt/gupu/yap-6/share/Yap/timeout.yap in module timeout, 0 msec 7104 bytes
  % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl...
  % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 410 msec 816824 bytes
  % reconsulting /home/ulrich/ftp/yap-prolog/library/pio.pl...
  % reconsulted /home/ulrich/ftp/yap-prolog/library/pio.pl in module pio, 10 msec 23048 bytes
  % reconsulting /home/ulrich/ftp/yap-prolog/library/item80.pl...
  % reconsulted /home/ulrich/ftp/yap-prolog/library/item80.pl in module user, 0 msec 7792 bytes
  % reconsulting /home/ulrich/ftp/yap-prolog/library/timeout_granularity.pl...
% Warning:  (/home/ulrich/ftp/yap-prolog/library/timeout_granularity.pl:15).
% Singleton variable I in user:run/0, clause 1.
  % reconsulted /home/ulrich/ftp/yap-prolog/library/timeout_granularity.pl in module user, 0 msec 6208 bytes
 % reconsulted /home/ulrich/.yaprc in module user, 430 msec 892208 bytes
   ?- fac(N,F), fac(M,F), N > 7.
F = 40320,
M = N = 8 ? ;
F = 362880,
M = N = 9 ? ;
F = 3628800,
M = N = 10 ? ;
F = 39916800,
M = N = 11 ? ;
F = 479001600,
M = N = 12 ? ;
F = 6227020800,
M = N = 13 ? ;
Action (h for help): a
%
%
% YAP OOOPS: tried to access illegal address 0x8!!!!.
%
%
9004KB of Code Space (0x2000000--0x28cb1d0)
%
% PC: clpfd:fd_get/3 at clause 1
%   Continuation: clpfd:fd_get/3 at clause 1
%    3228KB of Global Stack (0x31ef000--0x3516038)
%    1KB of Local Stack (0x3ab6b44--0x3ab7000)
%    11375KB of Trail (0x3ab7004--0x45d2c08)
%    Performed 1031 garbage collections
% All Active Calls and
%         Goals With Alternatives Open  (Global In Use--Local In Use)
%
 
   Exiting ....
1001.580u 0.680s 43:06.73 38.7% 0+0k 0+0io 504pf+0w
[ulrich@gupu ~]$
Yap-6.0.0.0-125-gb5a5e10
117: * compilation errors
gcc -c -O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes -DCOROUTINING=1 -DRATIONAL_TREES=1 -DDEPTH_LIMIT=1 -DHAVE_CONFIG_H -I. -I../H -I../OPTYap -I../BEAM -I../packages/MYDDAS -I../include  ../library/yap2swi/yap2swi.c  -o yap2swi.o
../library/yap2swi/yap2swi.c:945: warning: no previous prototype for âOsErrorâ
../library/yap2swi/yap2swi.c: In function âPL_eval_expression_to_int_64_exâ:
../library/yap2swi/yap2swi.c:2222: error: invalid storage class for function âSWI_ctimeâ
../library/yap2swi/yap2swi.c:2222: warning: no previous prototype for âSWI_ctimeâ
../library/yap2swi/yap2swi.c:2247: error: static declaration of âYap_swi_installâ follows non-static declaration
../library/yap2swi/yap2swi.c:2243: error: previous declaration of âYap_swi_installâ was here
../library/yap2swi/yap2swi.c:2249: error: expected declaration or statement at end of input
make: *** [yap2swi.o] Error 1
g3:/opt/gupu/src/yap-6/arch> history
...
    95  12:15   make clean
    96  12:15   history
    97  12:15   ../configure --prefix /opt/gupu/yap-6 --with-gmp --enable-couroutining && make clean && make depend && cd packages/PLStream && make depend
    98  12:16   cd ../..
    99  12:16   make
   100  12:17   history
116: *m voodoo pending goals
Truth turns into falsehood!
[ulrich@gupu library]$ yap-6 -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
   ?- freeze(X,false),throw(ex(X)).
     ERROR!!
     UNHANDLED EXCEPTION - message ex(_D1) unknown
   ?- true.
freeze(_A,user:false) ?
It is essential that the exception contains a variable with frozen goals.
The original transscript.
115: * current gcc warnings
114: * segfault
g3:/opt/gupu/src/yap-6/arch> yap-6 -f
Segmentation fault
(I confused the options with SICStus, indeed. But still this does not make a good impression)
Yap-6.0.0.0-115-gefb72f7
113: * make/0?
It seems to be implemented. But it does not seem to work (like in SWI).
112: * uncaught virtual time alarm
[ulrich@gupu docs]$ yap-6 -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
   ?-  use_module(library(timeout)).
 % reconsulting /opt/gupu/yap-6/share/Yap/timeout.yap...
  % reconsulting /opt/gupu/yap-6/share/Yap/hacks.yap...
  % reconsulted /opt/gupu/yap-6/share/Yap/hacks.yap in module yap_hacks, 10 msec 2768 bytes
 % reconsulted /opt/gupu/yap-6/share/Yap/timeout.yap in module timeout, 10 msec 4904 bytes
yes
   ?- time_out((repeat,fail),100,R).
Virtual time alarm
[ulrich@gupu docs]
(same on gupu, g3)
111: * manual
sentence beginning with:
The i.d.b. is implemented as a set of terms, accessed by keys that...
is unreadable. And I don't know how to correct that.
110: * internal freeze of setup_call_cleanup visible
Reappearance of #66
   ?- call_cleanup(between(1,2,I),between(10,11,K)).
I = 1,
freeze(_A,user:'$clean_call'(_B,user:between(10,11,K))) ?
109: * abort during read
When I press C-c at the toplevel when typing in a term, the system exits:
[ulrich@gupu library]$ yap-6 -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
   ?- abc
Action (h for help): ap):
 
% YAP execution aborted
For reproduction: I type abc RETURN C-c a RETURN
108: * missing existence error
   ?- swi_open(a,read,S),swi_close(S),swi_close(S).
no
existence error expected according to 13211-1:8.11.6.3f
../configure --prefix /opt/gupu/yap-6 --with-gmp --enable-couroutining && make clean && make depend && cd packages/PLStream && make depend
107: * closed streams loop
   ?- swi_open(a,read,S),swi_stream_property(S, position(P)),swi_close(S),swi_set_stream_position(S,P).
LOOPS
Expected: Some nice error. Preferably an existence error existence_error(stream, S_or_a) per analogiam 13211-1:8.11.3.3c.
106: * cleanup too early
   ?- setup_call_cleanup(true, (writeln(hic),freeze(X,writeln(nunc(X))),X=true), writeln(finis(X))).
hic
finis(_D4)
nunc(true)
X = true ?
Expected: nunc before finis:
hic
nunc(true)
finis(true)
Yap-6.0.0.0-102-g217afd3
105: * strip_module
What is bad about strip_module/3 is, that afterwards you have to maintain Modules and Goals separately. Maybe some deref/2 is prefereable?
104: * virtual_alarm missing
[ulrich@gupu yap-prolog]$ yap-6 -g 'write(now),nl,time_out(true,12345,R),write(ende),nl,halt.'
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
  % reconsulting /opt/gupu/yap-6/share/Yap/timeout.yap...
  % reconsulted /opt/gupu/yap-6/share/Yap/timeout.yap in module timeout, 0 msec 2336 bytes
  % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl...
  % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 380 msec 817144 bytes
  % reconsulting /home/ulrich/ftp/yap-prolog/library/pio.pl...
  % reconsulted /home/ulrich/ftp/yap-prolog/library/pio.pl in module pio, 0 msec 23464 bytes
 % reconsulted /home/ulrich/.yaprc in module user, 400 msec 868776 bytes
now
     ERROR!!
     EXISTENCE ERROR- procedure virtual_alarm/3 is undefined, called from context  prolog:$call/4
                 Goal was yap_hacks:virtual_alarm([12|345000],throw(time_out),_111)
Yap-6.0.0.0-100-g93a74d4
103: *
[ulrich@gupu yap-prolog]$ yap-6
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
  % reconsulting /opt/gupu/yap-6/share/Yap/timeout.yap...
  % reconsulted /opt/gupu/yap-6/share/Yap/timeout.yap in module timeout, 0 msec 2336 bytes
  % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl...
  % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 400 msec 817168 bytes
  % reconsulting /home/ulrich/ftp/yap-prolog/library/pio.pl...
  % reconsulted /home/ulrich/ftp/yap-prolog/library/pio.pl in module pio, 10 msec 23472 bytes
 % reconsulted /home/ulrich/.yaprc in module user, 420 msec 868824 bytes
   ?- swi_open(a,read,S),swi_read_pending_input(S,"a",""),swi_at_end_of_stream(S), swi_stream_property(S, position(Pos)),swi_set_stream_position(S, Pos).
yap-6: ../../../packages/PLStream/pl-file.c:3520: pl_stream_property_va: Assertion `0' failed.
Abort (core dumped)
Simpler reproduction:
   ?- swi_open(a,read,S),swi_stream_property(S, position(Pos)).
yap-6: ../../../packages/PLStream/pl-file.c:3520: pl_stream_property_va: Assertion `0' failed.
Abort (core dumped)
Yap-6.0.0.0-100-g93a74d4
102: *
[ulrich@gupu yap-prolog]$ yap-6
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
  % reconsulting /opt/gupu/yap-6/share/Yap/timeout.yap...
  % reconsulted /opt/gupu/yap-6/share/Yap/timeout.yap in module timeout, 10 msec 2168 bytes
  % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl...
  % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 360 msec 817144 bytes
  % reconsulting /home/ulrich/ftp/yap-prolog/library/pio.pl...
  % reconsulted /home/ulrich/ftp/yap-prolog/library/pio.pl in module pio, 10 msec 23472 bytes
 % reconsulted /home/ulrich/.yaprc in module user, 380 msec 855480 bytes
   ?- load_foreign_files([plstream], [], initIO).
yes
   ?- swi_open(a,read,S),swi_read_pending_input(S,"a",""),swi_read_pending_input(S,Xs0,Xs).
yap-6: error while loading shared libraries: /opt/gupu/yap-6/lib/Yap/plstream.so: undefined symbol: S__checkpasteeof
Expected Xs0 = Xs.
101: *
oops
[ulrich@gupu yap-prolog]$ echo -n a > a
[ulrich@gupu yap-prolog]$ yap-6 -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
   ?- load_foreign_files([plstream], [], initIO).
yes
   ?- swi_open(a,read,S),swi_read_pending_input(S,"a","").
%
%
% YAP OOOPS in USER C-CODE: tried to access illegal address 0x613!!!!.
%
%
1436KB of Code Space (0x2000000--0x21671d0)
%
% PC: meta-call
%   Continuation: prolog:$query/2 at clause 4
%    512KB of Global Stack (0x217f000--0x21ff0f0)
%    0KB of Local Stack (0x225fe80--0x2260000)
%    0KB of Trail (0x2260004--0x2260048)
%    Performed 1 garbage collections
% All Active Calls and
%         Goals With Alternatives Open  (Global In Use--Local In Use)
%
%  prolog:$query/2 at clause 4
%  prolog:$query/2 at clause 4
%  prolog:$command/4 at clause 2
%  prolog:$enter_top_level/0 at clause 6
%         prolog:$catch/3 (512KB--0KB)
%  prolog:$system_catch/4 at clause 1
%  meta-call
100: * missing library
[ulrich@gupu yap-prolog]$ yap-6 -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
   ?- swi_open(a,read,S),swi_read_pending_input(S,"a","").
no
   ?- load_foreign_files([plstream], [], initIO).
yes
   ?- swi_open(a,read,S),swi_read_pending_input(S,"a","").
yap-6: error while loading shared libraries: /opt/gupu/yap-6/lib/Yap/plstream.so: undefined symbol: allocList
[ulrich@gupu yap-prolog]$
Yap-6.0.0.0-94-g8e30d82
99: * now conflict
[ulrich@gupu arch]$ make
(cd packages/PLStream; make)
make[1]: Entering directory `/opt/gupu/src/yap-6/arch/packages/PLStream'
gcc -c -DBP_FREE -O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes   -I../../../packages/PLStream
-I../.. -I../../../packages/PLStream/../../include -I../../../packages/PLStream/uxnt  -shared -fPIC ../../../packages/PLStream/pl-os.c -o pl-os.o
../../../packages/PLStream/pl-os.c:284: conflicting types for `PL_clock_wait_ticks'
../../../packages/PLStream/pl-incl.h:551: previous declaration of `PL_clock_wait_ticks'
../../../packages/PLStream/pl-os.c: In function `System':
../../../packages/PLStream/pl-os.c:2207: warning: function declaration isn't a prototype
../../../packages/PLStream/pl-os.c:2208: warning: function declaration isn't a prototype
make[1]: *** [pl-os.o] Error 1
make[1]: Leaving directory `/opt/gupu/src/yap-6/arch/packages/PLStream'
make: *** [all] Error 2
[ulrich@gupu arch]$ git describe
Yap-6.0.0.0-93-g28f593f
[ulrich@gupu arch]$
98: * oops
[ulrich@gupu ~]$ yap-6 -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
   ?- load_foreign_files([plstream], [], initIO).
yes
   ?- open('/etc/passwd',read,S),swi_set_stream(S, buffer_size(10)).
%
%
% YAP OOOPS in USER C-CODE: tried to access illegal address 0x1f!!!!.
I admit, this is partially my error. (I should use swi_open/3). But you should detect this somehow.
97: * context missing
   ?-  catch(swi_open(A,B,C),Pat,true).
Pat = error(instantiation_error,context(_A,_B)) ?
yes
Yap-6.0.0.0-90-gedfcfe9
96: * ITIMER_VIRTUAL needed
For timeout I need the VIRTUAL time instead of the current REAL
[ulrich@gupu ~]$ strace yap-6 -f -g 'use_module(library(timeout)), write(now),nl,time_out(true,12345,R),write(ende),nl,halt.'
...
write(1, "now\n", 4now
)                    = 4
setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={12, 345000}}, {it_interval={0, 0}, it_value={0, 0}}) = 0
setitimer(ITIMER_REAL, {it_interval={0, 0}, it_value={0, 0}}, {it_interval={0, 0}, it_value={12, 350000}}) = 0
write(1, "ende\n", 5ende
)                   = 5
While SICStus uses:
[ulrich@gupu ~]$ strace sicstus -f --goal 'use_module(library(timeout)), write(now),nl,time_out(true,12345,R),write(ende),nl,halt.'
write(1, "now\n", 4now
)                    = 4
times({tms_utime=7, tms_stime=1, tms_cutime=0, tms_cstime=0}) = 506157
rt_sigaction(SIGVTALRM, {0x400db8c0, [], 0x4000000}, {SIG_IGN}, 8) = 0
setitimer(ITIMER_VIRTUAL, {it_interval={0, 0}, it_value={12, 350000}}, NULL) = 0
setitimer(ITIMER_VIRTUAL, {it_interval={0, 0}, it_value={0, 0}}, {it_interval={0, 0}, it_value={12, 360000}}) = 0
times({tms_utime=7, tms_stime=1, tms_cutime=0, tms_cstime=0}) = 506157
write(1, "ende\n", 5ende
)                   = 5
95: * SWI io
[ulrich@gupu yap-prolog]$ yap-6 -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
   ?- load_foreign_files([plstream], [], initIO).
PL_register_foreign_in_module called with non-implemented flag 24 when creating predicate (null):swi_stream_property/2
yes
   ?- swi_open(A,B,C).
%
%
% YAP OOOPS in USER C-CODE: .
Expected: Instantiation error.
[ulrich@gupu yap-prolog]$ yap-6 -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
   ?- load_foreign_files([plstream], [], initIO).
PL_register_foreign_in_module called with non-implemented flag 24 when creating predicate (null):swi_stream_property/2
yes
   ?- swi_open('/dev/null',read,B), swi_stream_property(B,position(Pos)), swi_set_stream_position(B,Pos).
HANGS
Expected: success.
94: * ISO WG 17 meeting
Now scheduled for Friday July 17th. I note, that you have a talk at 10h. Please, do not miss the meeting as in Udine!
93: * garbage collections not counted
   ?- Goal = (garbage_collect, statistics, Goal), Goal.
One line is strange:
      62.880 sec. for 0 garbage collections which collected 26920 bytes
There, the 0 does not move.
92: *: meta_predicate warnings
Meta arguments in a meta_predicate's head that are not unifiable with (:)/2 should get a warning/error, since they will lead to failure in the head. Take on_signal/3's first rule as an example...
   ?- [user].
| :- meta_predicate f(:).
| f(1).
| yes
Exected:
% Warning:  (user_input:6).
% Always failing clause due to meta argument 1 in user:f/1, clause 1.
91: * wrong meta_predicate declaration
Spec = thread_create(:,-,+) should be thread_create(:,-,:). Because you have an option at_exit! I would be pleased if there could be a nice YAP-SWI portable way (even better would be 13211-2 compilance) to encode that.
Yap-6.0.0.0-71-g3fc4f71
90: domain error misuse
consult.yap:55:	'$do_error'(domain_error(unimplemented_option,Opt),Call).
That does not make sense. representation_error would be better.
messages.yap:315:domain_error(not_empty_list, Opt) --> !,
non_empty_list
89: * cannot interrupt always
?- repeat,catch(time_out(throw(xixi),100,R),xixi,true), false.
Sometimes when pressing C-c the prompt is not offered.
2009-06-03 14:29:13 (CEST Wed) now:
[ulrich@gupu docs]$ yap-6
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
  % reconsulting /opt/gupu/yap-6/share/Yap/timeout.yap...
   % reconsulting /opt/gupu/yap-6/share/Yap/hacks.yap...
   % reconsulted /opt/gupu/yap-6/share/Yap/hacks.yap in module yap_hacks, 10 msec 4080 bytes
  % reconsulted /opt/gupu/yap-6/share/Yap/timeout.yap in module timeout, 10 msec 7104 bytes
  % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl...
  % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 380 msec 816736 bytes
  % reconsulting /home/ulrich/ftp/yap-prolog/library/pio.pl...
  % reconsulted /home/ulrich/ftp/yap-prolog/library/pio.pl in module pio, 10 msec 23240 bytes
  % reconsulting /home/ulrich/ftp/yap-prolog/library/item80.pl...
  % reconsulted /home/ulrich/ftp/yap-prolog/library/item80.pl in module user, 0 msec 6200 bytes
 % reconsulted /home/ulrich/.yaprc in module user, 410 msec 883912 bytes
   ?- repeat,catch(time_out(throw(xixi),100,R),xixi,true), false.
Action (h for help): a
     ERROR!!
     EXISTENCE ERROR- procedure 3/0 is undefined, called from context  prolog:$call/4
                 Goal was timeout:3
   ?- repeat,catch(time_out(throw(xixi),100,R),xixi,true), false.
Action (h for help): a
% YAP execution aborted
   ?- repeat,catch(time_out(throw(xixi),100,R),xixi,true), false.
Action (h for help): a
     ERROR!!
     UNHANDLED EXCEPTION - message xixi unknown
   ?- repeat,catch(time_out(throw(xixi),100,R),xixi,true), false.
Action (h for help): a
% YAP execution aborted
   ?- repeat,catch(time_out(throw(xixi),100,R),xixi,true), false.
Action (h for help): a
% YAP execution aborted
Yap-6.0.0.0-72-gad2ed67
88: * alarm/3 separate modes
The current approach is completely irritating:
[mein_modul]
   ?- alarm(1000,spezialprozedur,X).
X = 0 ?
yes
[mein_modul]
   ?- alarm(0, R,X).
R = spezialprozedur,
X = 0 ? ;
no
[mein_modul]
   ?- module(user).
yes
   ?- alarm(0, R,X).
no
   ?- module(mein_modul).
yes
[mein_modul]
   ?- alarm(0, R,X).
R = spezialprozedur,
X = 0 ?
For this reason, setting and resetting should be separated! meta_predicate arguments only work intuitively as input arguments.
87: * signal/2: double qualification
There is a meta-predicate declaration for alarm/3 and on_signal/3 fine. But on_signal still adds another prefix with '$current_module'(M)!
   ?- module(mein_modul).
yes
[mein_modul]
   ?- alarm(1000,spezialprozedur,_).
yes
[mein_modul]
   ?- on_signal(sig_alarm,A,true).
A = mein_modul:mein_modul:spezialprozedur ? ;
no
[mein_modul]
Expected:
A = mein_modul:spezialprozedur
86: * timeout semantics
There are two ways how to interpret timeouts on backtracking: 1st take the remaining time; 2nd take the timeouttime from start. I prefer the 2nd. This has been the semantics in SICStus (everytime it was accidentally changed, it was changed back). One reason behind is: you can simulate 1 with 2 (coarsely), but not the other way round. Then, it is useful for answers. The change is banal, but it should be made with some awarness of this issue.
85: *! alarm-problem
(would probably solve #84,#82,#69)
The items below are unrelated to library(timeout)!: On g3 (fast and ~ new)
g3:~> yap-6 -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
   ?- between(1,inf,I),catch(forall(repeat, (alarm([0|100],throw(time_out),_),alarm(0,_,_))),time_out,(write(timeout(I)),nl)),fail.
timeout(1)
timeout(2)
...
timeout(344)
timeout(345)
     ERROR!!
     INSTANTIATION ERROR- call((user:user:_77:_78,user:true)): expected bound value
This takes time! Don't give up. Run some other things in the background. I reproduce that with ~50% cpu for the process.
On gupu (old and slow) this is much faster
[ulrich@gupu yap-prolog]$ yap-6 -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
   ?-  forall(repeat, (alarm([0|10000],throw(time_out),_),alarm(0,_,_))).
     ERROR!!
     UNHANDLED EXCEPTION - message time_out unknown
   ?-  forall(repeat, (alarm([0|10000],throw(time_out),_),alarm(0,_,_))).
     ERROR!!
     INSTANTIATION ERROR- call((user:user:_33:_34,user:true)): expected bound value
   ?-

Observation: The variable-adresses in the error message seems to be proportional to the timeouts so far. So there is some global space that is used up.
[ulrich@gupu yap-prolog]$ yap-6
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
  % reconsulting /opt/gupu/yap-6/share/Yap/timeout.yap...
  % reconsulted /opt/gupu/yap-6/share/Yap/timeout.yap in module timeout, 0 msec 2128 bytes
  % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl...
PL_register_foreign_in_module called with non-implemented flag 24 when creating predicate (null):swi_stream_property/2
  % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 370 msec 821664 bytes
 % reconsulted /home/ulrich/.yaprc in module user, 370 msec 835128 bytes
   ?- between(1,inf,I),catch(forall(between(1,inf,J), (alarm([0|100],throw(time_out(I,J)),_),alarm(0,_,_))),time_out(Ix,Jx),(write(timeout(Ix,Jx,_)),nl)),fail.
timeout(1,76,_131290)
timeout(2,920,_131290)
timeout(3,231,_131290)
timeout(4,697,_131290)
timeout(5,1230,_131290)
timeout(6,102,_131290)
timeout(7,674,_131290)
timeout(8,1138,_131290)
timeout(9,315,_131290)
timeout(10,789,_131290)
timeout(11,456,_131290)
timeout(12,908,_131290)
timeout(13,332,_131290)
timeout(14,883,_131290)
timeout(15,557,_131290)
timeout(16,229,_131290)
timeout(17,54,_131290)
     ERROR!!
     INSTANTIATION ERROR- call((user:user:_150:_151,user:true)): expected bound value
   ?- between(1,inf,I),catch(forall(between(1,inf,J), (alarm([0|100],throw(time_out(I,J)),_),alarm(0,_,_))),time_out(Ix,Jx),(write(timeout(Ix,Jx,_)),nl)),fail.
timeout(1,251,_131290)
timeout(2,463,_131290)
timeout(3,463,_131290)
timeout(4,1387,_131290)
timeout(5,442,_131290)
timeout(6,545,_131290)
timeout(7,214,_131290)
timeout(8,1096,_131290)
timeout(9,332,_131290)
timeout(10,793,_131290)
timeout(11,450,_131290)
timeout(12,689,_131290)
timeout(13,1287,_131290)
timeout(14,669,_131290)
timeout(15,216,_131290)
timeout(16,687,_131290)
timeout(17,1489,_131290)
     ERROR!!
     INSTANTIATION ERROR- call((user:user:_311:_312,user:true)): expected bound value
   ?- between(1,inf,I),catch(forall(between(1,inf,J), (alarm([0|100],throw(time_out(I,J)),_),alarm(0,_,_))),time_out(Ix,Jx),(write(timeout(Ix,Jx,_)),nl)),fail.
timeout(1,444,_131290)
timeout(2,692,_131290)
timeout(3,191,_131290)
timeout(4,223,_131290)
timeout(5,1321,_131290)
     ERROR!!
     INSTANTIATION ERROR- call((user:user:_436:_437,user:true)): expected bound value
   ?- between(1,inf,I),catch(forall(between(1,inf,J), (alarm([0|100],throw(time_out(I,J)),_),alarm(0,_,_))),time_out(Ix,Jx),(write(timeout(Ix,Jx,_)),nl)),fail.
timeout(1,353,_131290)
     ERROR!!
     INSTANTIATION ERROR- call((user:user:_549:_550,user:true)): expected bound value
   ?- between(1,inf,I),catch(forall(between(1,inf,J), (alarm([0|100],throw(time_out(I,J)),_),alarm(0,_,_))),time_out(Ix,Jx),(write(timeout(Ix,Jx,_)),nl)),fail.
timeout(1,88,_131290)
timeout(2,690,_131290)
timeout(3,2936,_131290)
timeout(4,213,_131290)
timeout(5,2313,_131290)
     ERROR!!
     INSTANTIATION ERROR- call((user:user:_674:_675,user:true)): expected bound value
   ?- between(1,inf,I),catch(forall(between(1,inf,J), (alarm([0|100],throw(time_out(I,J)),_),alarm(0,_,_))),time_out(Ix,Jx),(write(timeout(Ix,Jx,_)),nl)),fail.
timeout(1,97,_131290)
timeout(2,462,_131290)
timeout(3,1585,_131290)
timeout(4,207,_131290)
timeout(5,445,_131290)
timeout(6,448,_131290)
timeout(7,1221,_131290)
timeout(8,215,_131290)
timeout(9,438,_131290)
timeout(10,1715,_131290)
     ERROR!!
     INSTANTIATION ERROR- call((user:user:_814:_815,user:true)): expected bound value
   ?-
84: * timeout-still here
   ?- repeat,time_out(true,10,R), false.
     ERROR!!
     INSTANTIATION ERROR- call((user:timeout:_143:_144,user:true)): expected bound value
83: * timeout missing
This should lead eventually (finally) to a timeout. But it doesn't,
   ?- time_out((length(L,N),length(L,N)),10,R), R \== success.
82: * timeout
[ulrich@gupu arch]$ yap-6
% Restoring file /opt/gupu/src/yap-6/arch/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
  % reconsulting /opt/gupu/yap-6/share/Yap/timeout.yap...
  % reconsulted /opt/gupu/yap-6/share/Yap/timeout.yap in module timeout, 0 msec 4544 bytes
  % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl...
PL_register_foreign_in_module called with non-implemented flag 24 when creating predicate (null):swi_stream_property/2
  % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 400 msec 821544 bytes
 % reconsulted /home/ulrich/.yaprc in module user, 410 msec 837440 bytes
   ?- repeat,time_out(true,10,R), R \== success.
 
true ? ;
 
true ? ;
 
true ? ;
;
true ? ;
 
true ? ;
 
true ? ;
 
true ? ;
 
true ? ;
 
true ? ;
 
true ? ;
 
true ? ;
     ERROR!!
     INSTANTIATION ERROR- call((user:timeout:_99:_100,user:true)): expected bound value
   ?-
Yap-6.0.0.0-64-g43e9e9f 2009-05-27 00:36:40 (CEST Wed)
81: * timeout
[ulrich@gupu arch]$ yap-6
% Restoring file /opt/gupu/src/yap-6/arch/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
  % reconsulting /opt/gupu/yap-6/share/Yap/timeout.yap...
  % reconsulted /opt/gupu/yap-6/share/Yap/timeout.yap in module timeout, 0 msec 3480 bytes
  % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl...
PL_register_foreign_in_module called with non-implemented flag 24 when creating predicate (null):swi_stream_property/2
  % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 370 msec 821640 bytes
 % reconsulted /home/ulrich/.yaprc in module user, 370 msec 836400 bytes
   ?- repeat,catch(time_out(throw(xixi),100,R),xixi,true).
 
true ? ;
 
     ERROR!!
     UNHANDLED EXCEPTION - message time_out unknown
   ?-
80: *! clpfd stateful
[ulrich@gupu yap-prolog]$ yap-6
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
  % reconsulting /opt/gupu/yap-6/share/Yap/timeout.yap...
  % reconsulted /opt/gupu/yap-6/share/Yap/timeout.yap in module timeout, 0 msec 3616 bytes
  % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl...
PL_register_foreign_in_module called with non-implemented flag 24 when creating predicate (null):swi_stream_property/2
  % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 380 msec 821584 bytes
 % reconsulted /home/ulrich/.yaprc in module user, 390 msec 836544 bytes
   ?- [user].
| fac(0, 1).  fac(N, F) :- N #> 0, F #= F0*N, N1 #= N - 1, fac(N1, F0).
| yes
?-  fac(N,F), fac(M,F), N > 7.
F = 40320,
M = 1,
N = 8 ? ;
F = 362880,
M = 1,
N = 9 ?
yes
   ?-  fac(N,F), fac(M,F), N > 7.
F = 40320,
M = N = 8 ?

2009-06-03 09:48:05 (CEST Wed) new behavior on gupu:
   ?- [user].
| fac(0, 1).  fac(N, F) :- N #> 0, F #= F0*N, N1 #= N - 1, fac(N1, F0).
| yes
   ?- fac(N,F), fac(M,F), N > 7.
F = 40320,
M = N = 8 ? ;
F = 362880,
M = N = 9 ? ;
F = 3628800,
M = N = 10 ? ;
F = 39916800,
M = 1,
N = 11 ? ;
3692KB of Code Space (0x2000000--0x239b1d0)
%
% PC: prolog:get_attr/3 at clause 1
%   Continuation: clpfd:trigger_prop/1 at clause 1
%    518KB of Global Stack (0x23cf000--0x2450988)
%    1KB of Local Stack (0x28b0b34--0x28b1000)
%    74KB of Trail (0x28b1004--0x28c3b64)
%    Performed 9 garbage collections
% All Active Calls and
%         Goals With Alternatives Open  (Global In Use--Local In Use)
%
%  clpfd:trigger_prop/1 at clause 1
%  clpfd:trigger_prop/1 at clause 1
%  clpfd:trigger_props_/1 at clause 2
%  clpfd:trigger_props/4 at clause 1
%  clpfd:run_propagator/2 at clause 14
%  clpfd:do_queue/0 at clause 1
%  attributes:do_hook_attributes/2 at clause 2
%  attributes:woken_att_do/2 at clause 1
%  prolog:$execute_woken_system_goals/1 at clause 2
%  prolog:$wake_up_goal/2 at clause 1
%  clpfd:do_queue/0 at clause 1
%  attributes:do_hook_attributes/2 at clause 2
%  attributes:woken_att_do/2 at clause 1
%  prolog:$execute_woken_system_goals/1 at clause 2
%  prolog:$wake_up_goal/2 at clause 1
%         user:fac/2 (517KB--0KB)
%         user:fac/2 (516KB--0KB)
%  prolog:$query/2 at clause 4
%  prolog:$command/4 at clause 2
%  prolog:$enter_top_level/0 at clause 6
%         prolog:$catch/3 (512KB--0KB)
%  prolog:$system_catch/4 at clause 1
%  meta-call
     ERROR!!
     RESOURCE ERROR- not enough stack
79: * predicate_property
   ?- predicate_property(_,(meta_predicate call(:))).
no
   ?- predicate_property(call(_),(meta_predicate call(:))).
yes
Success expected. I want to search for all meta_predicate s with
?- predicate_property(_, (meta_predicate Spec)).
Yap-6.0.0.0-58-g3c57286
78: * confusing error message
   ?- read_from_chars("s(_, _, _, _, _, _, _)",Term).
     end of file found before end of term at charsio, near line 1:
 
<==== HERE ====>
 s( _ , _ , _ , _ ,
 _ , _ , _ ).
   ?-
Why HERE? Why is a . shown? Why the linebreak? The name should be read_from_codes.
77: * BIPs missing
atom_to_term, =@=
76: * unify_with_occurs_check/2
   ?- X=s(X), unify_with_occurs_check(X,Z).
no
   ?- X=s(X), unify_with_occurs_check(X,X).
no
This is highly problematic, as we can no longer assume that X = X succeeds always. By the same token, Freshvar = Term now sometimes fails. This essentially ruins all classical optimizations. See these WLPE-slides in Udine (I believe you did not attend it). It is nice that unify_with_occurs_check/2 always terminates in YAP, but it would be nicer if those properties would be obeyed as well. (Currently, SWI does not terminate always.)
75: * stream position missing
   ?- open('/dev/null',read,B), stream_property(B,position(Pos)), set_stream_position(B,Pos).
     ERROR at  clause 4 of prolog:set_stream_position/2 !!
     DOMAIN ERROR- set_stream_position/2: false is not a stream position
Expected: Pos should be a term to allow repositioning. (This seems to be related to your project to adopt SWI's I/O. How far is that?)
This is still highly experimental, and Jan made a lot of changes so I haven't been able to keep track. :- expects_dialect(swi). apologies You can just load the library :- load_foreign_files([plstream], [], initIO).
74: * future of read_pending_input/3
The name is misleading. It is unrelated to read/1. It produces a difference of codes. Why not chars as well? get_codes/3 get_chars/3? Or should that be goverened by double_quotes? (And: how do I get that functionality - it is not compiled by default)
73: * time_out seconds
   ?- time_out(length(L,L),-1,R).
R = time_out ?
yes
Why does this take a second or so? A domain_error not_less_than_zero, or between(1,2147483646) would be most appropriate.
72: * DCG support needed
:- meta_predicate ^(?,0,?).
^(Xs, Goal, Xs) :- call(Goal).
:- meta_predicate ^(?,1,?,?).
^(Xs0, Goal, Xs0, Xs) :- call(Goal, Xs).
Examples:
   ?- phrase(([a],call(Ys0^Ys^(Ys0=Ys)),[o]),Xs0,Xs).
Xs0 = [a,o|Xs],
Ys = Ys0 = [o|Xs] ? ;
no
   ?- phrase(([a],call(Ys0^(=(Ys0))),[o]),Xs0,Xs).
Xs0 = [a,o|Xs],
Ys0 = [o|Xs] ? ;
no
   ?- phrase(([a],call(=),[o]),Xs0,Xs).
Xs0 = [a,o|Xs] ? ;
no
71: * uniform and efficient error reporting
(common SWI-YAP problem) There is library(error), but currently it is rarely used. Should there be a "cheaper" interface?
70: * time_out/3 not reentrant
The problem is that there is no way to detect and report accidental uses of nested calls. Ideally some error should be reported like representation_error(reentrant). Similarly for attempts to backtrack into the timeout. Even better would be to support all this like SICStus does.
Yap-6.0.0.0-8-g2020a19
69: f timeout
[ulrich@gupu yap-prolog]$ yap-6
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
  % reconsulting /opt/gupu/yap-6/share/Yap/timeout.yap...
  % reconsulted /opt/gupu/yap-6/share/Yap/timeout.yap in module timeout, 0 msec 1968 bytes
 % reconsulted /home/ulrich/.yaprc in module user, 0 msec 4216 bytes
   ?- repeat,time_out(true,10,R), R \== success.
R = time_out ? ;
     ERROR!!
     UNHANDLED EXCEPTION - message time_out unknown
And on g3:
  ?- g3:/opt/gupu/src/yap-6/arch> yap-6 -f none
% Restoring file /opt/gupu/src/yap-6/arch/startup.yss
YAP version Yap-6.0.0
   ?- use_module(library(timeout)).
 % reconsulting /opt/gupu/yap-6/share/Yap/timeout.yap...
 % reconsulted /opt/gupu/yap-6/share/Yap/timeout.yap in module timeout, 0 msec 2960 bytes
yes
   ?- repeat,time_out(true,10,R), R \== success.
     ERROR!!
     INSTANTIATION ERROR- call((user:timeout:_77:_78,user:true)): expected bound value

Now 2009-05-26 15:25:51 (CEST Tue) there is no possibility to interrupt this
68: f timeout and setup_call_cleanup
   ?- use_module(library(timeout)).
 % reconsulting /opt/gupu/yap-6/share/Yap/timeout.yap...
 % reconsulted /opt/gupu/yap-6/share/Yap/timeout.yap in module timeout, 0 msec 2960 bytes
yes
   ?- repeat,time_out(setup_call_cleanup((retractall(a),assert(a)),true,(findall(a,retract(a),As),As\=[a],write(As),nl)), 10, R), R \= success.
[]
R = time_out ? ;
[]
R = time_out ? ;
     ERROR!!
     UNHANDLED EXCEPTION - message time_out unknown

2009-05-26 15:29:52 (CEST Tue) same as #69
Yap-6.0.0.0-5-g2605724
67: * call_cleanup gone?
   ?- g3:/opt/gupu/src/yap-6/arch> yap-6 -f none
% Restoring file /opt/gupu/src/yap-6/arch/startup.yss
YAP version Yap-6.0.0
   ?- predicate_property(call_cleanup(A,B),X).
X = built_in ? yes
   ?-
   | call_cleanup(X=1,true).
no
66: * setup_call_cleanup/3: between/3 nondeterminate?
   ?- setup_call_cleanup(true,between(1,3,I),between(10,11,K)).
I = 1,
freeze(_A,user:'$clean_call'(user:between(10,11,K))) ? ;
I = 2,
freeze(_A,user:'$clean_call'(user:between(10,11,K))) ? ;
I = 3,
freeze(_A,user:'$clean_call'(user:between(10,11,K))) ? ;
no
SWI gives:
?- setup_call_cleanup(true,between(1,3,I),between(10,11,K)).
I = 1 ;
I = 2 ;
I = 3,
K = 10.
Yap-6.0.0.0-4-gb38505c (reappearance as #
65: * setup_call_cleanup
[ulrich@gupu yap-prolog]$ yap-6 -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
   ?- setup_call_cleanup(between(1,4,I),between(10,14,J),between(20,24,K)).
I = 1,
J = 10,
freeze(_A,user:'$clean_call'(user:between(20,24,K))) ?
Is it necessary to show that goal?
64: * bleq/1 slow
blam.pl
   ?- time(bleq(28)).
% 33.030 CPU in 33.033 seconds ( 99% CPU)
yes
While SWI:
?- time(bleq(28)).
% 66 inferences, 0.00 CPU in 0.00 seconds (0% CPU, Infinite Lips)
true.
63: * Targets for setup_call_cleanup/3
62: * library(charsio)
   ?- format_to_chars('x~d',[234],Xs0,Xs).
Xs = [120,50,51,52|Xs0] ?
yes
This is wrong. The convention is always in the other direction. Such that it can used within a DCG (now officially via call//1) SICStus 3 gives:
| ?- format_to_chars('x~d',[234],Xs0,Xs).
Xs0 = [120,50,51,52|Xs] ?
yes
61: * timeout core dump
[ulrich@gupu ~]$ yap-6
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
  % reconsulting /opt/gupu/yap-6/share/Yap/timeout.yap...
  % reconsulted /opt/gupu/yap-6/share/Yap/timeout.yap in module timeout, 0 msec 2168 bytes
 % reconsulted /home/ulrich/.yaprc in module user, 0 msec 3816 bytes
   ?- time(time_out(length(L,L),1,R)).
% 0.010 CPU in 0.007 seconds (142% CPU)
R = time_out ?
yes
   ?- time(time_out(length(L,L),1,R)).
% 0.050 CPU in 0.060 seconds ( 83% CPU)
R = time_out ?
yes
   ?- time(time_out(length(L,L),1,R)).
Abort (core dumped)
[ulrich@gupu ~]$
60: * resource error expected
   ?- catch((repeat,open('/dev/null',read,S),fail),Pat,true).
Pat = error(system_error,['new stream not available for open/3'|local_sp(34070908,34070832,[],[])]) ?
For ISO and SWI compatibility
8.11 Stream selection and control ... NOTE - Some of these built-in predicates may cause a Resource Error (7.12.2 h) because, for example, the program has opened too many streams, or a file or disk is full.
59: * time_out not happening
Interrupts do not work as well
   ?- time_out(findall(f(L,N),length(L,N),_),1,R).
58: *m GC no space shrinks?
It seems somehow that space is never reduced, after executing a goal. Possible? Reproduction:
yap-6 -f none -g 'catch((between(0,3000,F),N is 1024*1024*F, M is N, garbage_collect,statistics,write(F=M),nl, catch((functor(_,f,M),fail),error(resource_error(_),_),fail)),Pat,true).'
C-c it sometime and type statistics: Clearly, the "memory (total)" increases, but then never decreases.
57: * representation errors put_attr,open
   ?- put_attr(a,b,c).
no
I expect an error. But not a type error: Type errors can always be replaced by failure. This here should be a representation error (variable). Justification (for SWI, SICStus):
Type errors should be when we expect some concrete term of a certain type, but get a term of another type instead. A variable isn't such a term. Further, type errors indicate situations where otherwise a silent failure would happen. But it is easy to construct cases, where success happens in that very place.
56: * cleanups sometimes/never
Let the following run a little and then C-c, on gupu,g3,a4
[ulrich@gupu arch]$ yap-6
% Restoring file /opt/gupu/src/yap-6/arch/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
 % reconsulted /home/ulrich/.yaprc in module user, 0 msec 216 bytes
   ?- call_cleanup(findall(a,repeat,_),write(cleanup)).
Action (h for help): a
no
   ?- call_cleanup(findall(a,repeat,_),write(cleanup)).
Action (h for help): a
no
   ?- call_cleanup(findall(a,repeat,_),write(cleanup)).
Action (h for help): a
cleanupcleanup% YAP execution aborted
   ?-
Same with asserta
   ?- listing(a),retractall(a),  call_cleanup(findall(a,repeat,_),asserta(a)).
a.
a.
Action (h for help): a
% YAP execution aborted
   ?- listing(a),retractall(a),  call_cleanup(findall(a,repeat,_),asserta(a)).
a.
a.
Expected: Exactly one fact, or message.
Yap-6.0.0.0-2-g13b9098
commit 17e36dbda17b6a6a2551682b464d9d5bcd417c8b 2009-05-18 -#31
55: * when/2
   ?- when(X,X).
X = nonvar(_A),
user:nonvar(_A) ?
Remark on write_canonical
   ?- write_canonical([a,b,c]).
[a,b,c]yes
This is not conformant - but I like it, as it better reflects the intention behind: immunity against operator declarations. Actually it should be (with a space in the nil - don't ask why).
.(a,.(b,.(c,[ ])))
Only Minerva and XSB print [a,b,c]. All other systems print '.'(a,...). Also, the description suggests '.'(a,...). For this reason it is definitely best to go with the flock. If someone wants a safe way to print with []-lists and {}, there is a clean way to do this: Turn off all operator declarations.
54: *m enforcing 32-bit mode on 64-bit?
Ideally as a configure option. Many errors are easier to observe under 32 bit.
53: * uncaught exception
[ulrich@gupu yap-prolog]$ yap-6 -l item53.pl -g run
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
 % reconsulted /home/ulrich/.yaprc in module user, 0 msec 216 bytes
%
%
% YAP OOOPS: tried to access illegal address (nil)!!!!.
%
%
1084KB of Code Space (0x2000000--0x210f190)
4097KB of Global Stack (0x212e000--0x252e570)
0KB of Local Stack (0x25f5e9c--0x25f6000)
0KB of Trail (0x25f6004--0x25f6034)
Performed 1 garbage collections
Running code at meta-call
Continuation is at clause 1 of prolog:once/1
     indexing code of prolog:$handle_throw/3 (*)
  clause 1 of prolog:once/1
  clause 3 of prolog:$startup_goals/0 (*)
  clause 1 of prolog:$init_system/0
  clause 1 of prolog:$live/0
  meta-call
 
   Exiting ....
Old version now overshadowed:

[ulrich@gupu arch]$ /opt/gupu/yap-6/bin/yap
% Restoring file /opt/gupu/src/yap-6/arch/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
 % reconsulted /home/ulrich/.yaprc in module user, 0 msec 216 bytes
   ?- length(L,a).
%
%
% YAP OOOPS: tried to access illegal address (nil)!!!!.
%
%
1084KB of Code Space (0x2000000--0x210f190)
4096KB of Global Stack (0x212e000--0x252e338)
0KB of Local Stack (0x25f5e98--0x25f6000)
0KB of Trail (0x25f6004--0x25f6030)
Performed 1 garbage collections
Running code at meta-call
Continuation is at clause 4 of prolog:$query/2
     indexing code of prolog:$handle_throw/3 (*)
  clause 4 of prolog:$query/2
  meta-call
 
   Exiting ....
Remark: by applying patch Made-length-steadfast-for, this problem vanishes...
52: * OOPS in $update_att
on gupu (an old 32-bit)
[ulrich@gupu yap-prolog]$ /opt/gupu/yap-6/bin/yap -l freezetest.pl -g run
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
 % reconsulted /home/ulrich/.yaprc in module user, 0 msec 216 bytes
memory (total)        6373372 bytes
   program space      1228800 bytes:    1106768 in use,       122032 free
                                                                   0  max
   stack space        5013504 bytes:    4196020 in use,       817484 free
     global stack:                      4195632 in use,      4196072  max
      local stack:                          388 in use,         1344  max
   trail stack         131068 bytes:         48 in use,       131020 free
 
       0.000 sec. for 0 code, 1 stack, and 0 trail space overflows
       0.000 sec. for 1 garbage collections which collected 0 bytes
       0.000 sec. for 0 atom garbage collections which collected 0 bytes
       0.010 sec. runtime
       0.010 sec. cputime
       0.010 sec. systime
       0.004 sec. elapsed time
 
10^5.0=100000
memory (total)       18075644 bytes
   program space      5758976 bytes:    3925520 in use,      1833456 free
                                                                   0  max
   stack space       11931648 bytes:    5967856 in use,      5963792 free
     global stack:                      5967436 in use,      7057032  max
      local stack:                          420 in use,         1344  max
   trail stack         385020 bytes:     131460 in use,       253560 free
 
       0.320 sec. for 2 code, 4 stack, and 1 trail space overflows
       0.730 sec. for 8 garbage collections which collected 9027776 bytes
       0.000 sec. for 0 atom garbage collections which collected 0 bytes
       2.930 sec. runtime
       3.980 sec. cputime
       0.070 sec. systime
       4.231 sec. elapsed time
...
10^6.46239799789896=2900000
memory (total)       65712124 bytes
   program space     44244992 bytes:   17098256 in use,     27146736 free
                                                                   0  max
   stack space       20320256 bytes:    4269872 in use,     16050384 free
     global stack:                      4269452 in use,     19073656  max
      local stack:                          420 in use,         1344  max
   trail stack        1146876 bytes:       5684 in use,      1141192 free
 
       3.110 sec. for 6 code, 5 stack, and 2 trail space overflows
      10.140 sec. for 29 garbage collections which collected 313124532 bytes
       0.000 sec. for 0 atom garbage collections which collected 0 bytes
     355.850 sec. runtime
     369.100 sec. cputime
       0.830 sec. systime
     378.945 sec. elapsed time
%
%
% YAP OOOPS: tried to access illegal address 0x813cff8!!!!.
%
%
16768KB of Code Space (0x2000000--0x3060190)
  Current hole: 0x803d000--0x813d000
8413KB of Global Stack (0xa2e3000--0xab1a76c)
0KB of Local Stack (0xb643e78--0xb644000)
319KB of Trail (0xb644004--0xb693fd8)
Performed 29 garbage collections
Running code at clause 2 of prolog:$update_att/2
Continuation is at clause 2 of user:recfreeze/1
  clause 2 of user:recfreeze/1
  clause 1 of prolog:once/1
  clause 2 of prolog:$do_yes_no/2
  clause 1 of prolog:$yes_no/2 (*)
     indexing code of prolog:$catch/3 (*)
  clause 1 of prolog:$system_catch/4
  clause 3 of prolog:$startup_goals/0 (*)
  clause 1 of prolog:$init_system/0
  clause 1 of prolog:$live/0
  meta-call
 
   Exiting ....
375.320u 1.080s 6:26.00 97.5%   0+0k 0+0io 397pf+0w
51: *! OOPS in CLPFD
(only on 32-bit)
[ulrich@gupu ~]$ yap-6
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
 % reconsulted /home/ulrich/.yaprc in module user, 0 msec 216 bytes
   ?- [user].
| :- use_module(library(clpfd)).
  % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl...
PL_register_foreign_in_module called with non-implemented flag 24 when creating predicate (null):swi_stream_property/2
  % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 740 msec 825576 bytes
| fac(0, 1).  fac(N, F) :- N #> 0, F #= F0*N, N1 #= N - 1, fac(N1, F0).
| yes
   ?- fac(N,F), N > 9, fac(M,F).
Action (h for help): a
% YAP execution aborted
   ?- N = 10, fac(N,F), N > 9, fac(M,F).
%
%
% YAP OOOPS: tried to access illegal address 0x2e0200dc!!!!.
%
%
8180KB of Code Space (0x2000000--0x27fd190)
4097KB of Global Stack (0x3210000--0x3610740)
0KB of Local Stack (0x4570c8c--0x4571000)
0KB of Trail (0x4571004--0x45711b8)
Performed 43 garbage collections
Running code at clause 1 of prolog:get_attr/3
Continuation is at clause 1 of clpfd:put_terminating/3
  clause 1 of clpfd:put_terminating/3
  clause 1 of clpfd:put_terminating/3
  clause 14 of clpfd:run_propagator/2
  clause 1 of clpfd:do_queue/0
  clause 1 of clpfd:clpfd_equal/2
  clause 2 of user:fac/2
     indexing code of user:fac/2 (*)
  clause 4 of prolog:$query/2
  clause 2 of prolog:$command/4
  clause 6 of prolog:$enter_top_level/0
     indexing code of prolog:$catch/3 (*)
  clause 1 of prolog:$system_catch/4
  meta-call
 
   Exiting ....
66.170u 0.240s 2:07.23 52.1%    0+0k 0+0io 487pf+0w
50: * very long clpfd
[ulrich@gupu ~]$ yap-6
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
 % reconsulted /home/ulrich/.yaprc in module user, 0 msec 216 bytes
   ?- use_module(library(clpfd)).
 % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl...
PL_register_foreign_in_module called with non-implemented flag 24 when creating predicate (null):swi_stream_property/2
 % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 710 msec 825560 bytes
yes
   ?- [user].
| fac(0, 1).
| fac(N, F) :- N #> 0, F #= F0*N, N1 #= N - 1, fac(N1, F0).
| yes
   ?- fac(N,3628800).
   ?- time(fac(N,3628800)).
% 122.940 CPU in 128.592 seconds ( 95% CPU)
(takes very long)
In SWI this requires only % 5,774,839 inferences, 9.42 CPU in 9.53 seconds (99% CPU, 613040 Lips)
49: * unshared unification
This program should run(N) in space proportional to N. Rational unification and normal GC should be enough to do so.
48: @ unify_with_occurs_check/2 slow
 [ulrich@gupu yap-prolog]$ /opt/gupu/yap-6/bin/yap
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
 % reconsulted /home/ulrich/.yaprc in module user, 0 msec 216 bytes
   ?- [fastunification].
 % consulting /home/tour/yap-prolog/fastunification.pl...
 % consulted /home/tour/yap-prolog/fastunification.pl in module user, 0 msec 2192 bytes
yes
   ?- test(A).
A = 2^18-440 ? ;
A = 2^19-1270 ? ;
A = 2^20-4850 ? ;
A = 2^21-18640 ? ;
A = 2^22-74530 ?
A local variable-term unification should be performed in constant time! Somewhere in C/unify.c:OCUnify the test is missing.
Its a global variable only, that is responsible
47: * call_cleanup and traces
[ulrich@gupu ~]$ yap-6 -G5000
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
 % reconsulted /home/ulrich/.yaprc in module user, 0 msec 216 bytes
   ?- T=call_cleanup(T,T),T.
1084KB of Code Space (0x2000000--0x210f190)
4147KB of Global Stack (0x212e000--0x253ad8c)
45KB of Local Stack (0x2604990--0x2610000)
13KB of Trail (0x2610004--0x2613558)
Performed 1 garbage collections
Running code at clause 2 of prolog:$update_att/2
Continuation is at clause 1 of prolog:$call_cleanup/3
  clause 1 of prolog:$call_cleanup/3
     indexing code of prolog:$catch/3 (*)
  clause 1 of prolog:catch/3
  clause 1 of prolog:$call_cleanup/3
     indexing code of prolog:$catch/3 (*)
... indefinitely
Yap-6.0.0.0-2-g13b9098:
%  prolog:$call_cleanup/3 at clause 1
%         prolog:$catch/3 (1048KB--27KB)
%  prolog:catch/3 at clause 1 Action (h for help): a
% ERROR WITHIN ERROR: abort from console
g3:/opt/gupu/src/yap-6/arch>
Expected: resource errors
46: * missing resource or type error
   ?- X=1+X, Y is X.
Segmentation fault (core dumped)
45: * incorrect toplevel
   ?- X = (a:-b).
X = a:-b ?
yes
   ?- X = (1 = 1).
X = 1=1 ? ;
Answer must be a valid Prolog term. Maybe consider in general a harmonization of SWI and YAP toplevel? SWI isn't perfect too: it lacks the "Vienna branch" since more than a year.
44: * GMP memory overflow uncaught
[ulrich@gupu ~]$ /opt/gupu/yap-6/bin/yap
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
 % reconsulted /home/ulrich/.yaprc in module user, 10 msec 216 bytes
   ?- length(_,N),catch(X is 1<<(1<<N),error(resource_error(_),_), fail),fail.
%
%
% YAP OOOPS: tried to access illegal address (nil)!!!!.
%
%
4156KB of Code Space (0x2000000--0x240f190)
6156KB of Global Stack (0x25c0000--0x2bc33b8)
0KB of Local Stack (0x2f20dd8--0x2f21000)
0KB of Trail (0x2f21004--0x2f2109c)
Performed 4 garbage collections
Running code at clause 1 of prolog:throw/1
Continuation is at clause 3 of prolog:$call/4
  clause 3 of prolog:$call/4
     indexing code of prolog:$$_length1/3 (*)
  clause 4 of prolog:$query/2
  clause 2 of prolog:$command/4
  clause 6 of prolog:$enter_top_level/0
     indexing code of prolog:$catch/3 (*)
  clause 1 of prolog:$system_catch/4
  meta-call
 
   Exiting ....
6.180u 1.620s 0:20.88 37.3%     0+0k 0+0io 440pf+0w
43: *!m memory overflow not caught repeatedly
Current (2009-06-13 Yap-6.0.0.0-158-gcbcb05f) behaviour on gupu:
   ?- between(1,10000,N), write(call(N)),nl, catch(length(L,L),Pat,true), write(N:Pat),nl,false.
call(1)
1:error(resource_error(stack),Database crashed against stacks)
call(2)
LOOPS
And on g3:
g3:~> yap-6 -f none -G5000
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
   ?-  between(1,10000,N), write(call(N)),nl, catch(length(L,L),Pat,true), write(N:Pat),nl,false.
call(1)
%
%
% YAP OOOPS: tried to access illegal address (nil)!!!!.
%
%
2888KB of Code Space (0x2000000--0x22d21a0)
%
% PC: meta-call
%   Continuation: prolog:catch/3 at clause 1
%    4842KB of Global Stack (0x232d000--0x27e7a08)
%    1KB of Local Stack (0x280eb20--0x280f000)
%    0KB of Trail (0x280f008--0x280f0a0)
%    Performed 1 garbage collections
% All Active Calls and
%         Goals With Alternatives Open  (Global In Use--Local In Use)
%
%         prolog:$handle_throw/3 (4842KB--1KB)
%  prolog:catch/3 at clause 1
%  prolog:$call/4 at clause 3
%         prolog:$between/3 (1024KB--0KB)
%  prolog:$query/2 at clause 4
%  prolog:$command/4 at clause 2
%  prolog:$enter_top_level/0 at clause 6
%         prolog:$catch/3 (1024KB--0KB)
%  prolog:$system_catch/4 at clause 1
%  meta-call
 
   Exiting ....

Original:
   ?- [ulrich@gupu ~]$ /opt/gupu/yap-6/bin/yap -G5000
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
 % reconsulted /home/ulrich/.yaprc in module user, 0 msec 216 bytes
   ?- between(1,10000,N), catch(length(L,L),Pat,true), write(N:Pat),nl,false.
2752KB of Code Space (0x2000000--0x22b0190)
4686KB of Global Stack (0x22cf000--0x2762938)
0KB of Local Stack (0x27b0d90--0x27b1000)
0KB of Trail (0x27b1004--0x27b105c)
Performed 2 garbage collections
Running code at clause 2 of prolog:$$_length1/3
Continuation is at clause 1 of prolog:catch/3
     indexing code of prolog:$catch/3 (*)
  clause 1 of prolog:catch/3
  clause 3 of prolog:$call/4
     indexing code of prolog:between/3 (*)
  clause 4 of prolog:$query/2
  clause 2 of prolog:$command/4
  clause 6 of prolog:$enter_top_level/0
     indexing code of prolog:$catch/3 (*)
  clause 1 of prolog:$system_catch/4
  meta-call
1:error(out_of_stack_error,Database crashed against stacks)
2752KB of Code Space (0x2000000--0x22b0190)
4686KB of Global Stack (0x22cf000--0x2762b84)
0KB of Local Stack (0x27b0d90--0x27b1000)
0KB of Trail (0x27b1004--0x27b1050)
Performed 3 garbage collections
Running code at clause 2 of prolog:$$_length1/3
Continuation is at clause 1 of prolog:catch/3
     indexing code of prolog:$catch/3 (*)
  clause 1 of prolog:catch/3
  clause 3 of prolog:$call/4
     indexing code of prolog:between/3 (*)
  clause 4 of prolog:$query/2
  clause 2 of prolog:$command/4
  clause 6 of prolog:$enter_top_level/0
     indexing code of prolog:$catch/3 (*)
  clause 1 of prolog:$system_catch/4
  meta-call
2752KB of Code Space (0x2000000--0x22b0190)
4096KB of Global Stack (0x22cf000--0x26cf170)
0KB of Local Stack (0x27b0d54--0x27b1000)
0KB of Trail (0x27b1004--0x27b1048)
Performed 4 garbage collections
Running code at clause 1 of prolog:catch_ball/2
Continuation is at clause 2 of prolog:$handle_throw/3
  clause 2 of prolog:$handle_throw/3 (*)
  clause 2 of prolog:$handle_throw/3
  clause 3 of prolog:$call/4
     indexing code of prolog:between/3 (*)
  clause 4 of prolog:$query/2
  clause 2 of prolog:$command/4
  clause 6 of prolog:$enter_top_level/0
     indexing code of prolog:$catch/3 (*)
  clause 1 of prolog:$system_catch/4
  meta-call
     ERROR!!
     OUT OF STACK SPACE ERROR- Database crashed against stacks
   ?-
Expected:
1:error(resource_error(Qua),QuidQuid)
2:error(resource_error(Qua),QuidQuid)
...
42: * memory overflow wrong error
   ?- [ulrich@gupu ~]$ yap-6 -G5000
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
 % reconsulted /home/ulrich/.yaprc in module user, 0 msec 216 bytes
   ?- catch(length(L,L),Pat,true).
2752KB of Code Space (0x2000000--0x22b0190)
4686KB of Global Stack (0x22cf000--0x27629f8)
0KB of Local Stack (0x27b0e50--0x27b1000)
0KB of Trail (0x27b1004--0x27b1058)
Performed 2 garbage collections
Running code at clause 2 of prolog:$$_length1/3
Continuation is at clause 1 of prolog:catch/3
     indexing code of prolog:$catch/3 (*)
  clause 1 of prolog:catch/3
  clause 4 of prolog:$query/2
  clause 2 of prolog:$command/4
  clause 6 of prolog:$enter_top_level/0
     indexing code of prolog:$catch/3 (*)
  clause 1 of prolog:$system_catch/4
  meta-call
Pat = error(out_of_stack_error,'Database crashed against stacks') ?
Expected:
Pat = error(resource_error(Something), Further_Information)
41: !! copy_term/3
The third argument should be a term, that can be called with maplist(call,Goals) to reconstruct the state.
   ?- freeze(X,false), copy_term(X,X,Goals).
Goals = [user:false],
user:false ? ;
Calling Goals here would result in failure, but we need freeze(X,false) instead.
   ?- freeze(X,false), freeze(X,true),copy_term(X,X,Goals).
Goals = prolog:freeze(X,user:true),prolog:freeze(X,user:false),
freeze(X,user:true),
freeze(X,user:false) ?
yes
This is not compatible with SWI. Please reconsider using ands instead of a clean list! Expected: Goals = [prolog:freeze(X,user:true),prolog:freeze(X,user:false)],
40: * -G limit does not work, no statistics
[ulrich@gupu yap-prolog]$ /opt/gupu/yap-6/bin/yap -G5000
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
 % reconsulted /home/ulrich/.yaprc in module user, 0 msec 216 bytes
   ?- length(L,L).
Action (h for help): s
no
   ?-
-G5000 seems to be the minimum. -G4000 produces a fatal error. However this still loops. Also, statistics do not work.
39: Q resource error expected
[ulrich@gupu yap-prolog]$ /opt/gupu/yap-6/bin/yap -G10m
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
 % reconsulted /home/ulrich/.yaprc in module user, 0 msec 216 bytes
   ?- N is 1024*1024*50, functor(F,f,N),false.
no
See #42
38: *!!m -G option
32-bit
[ulrich@gupu yap-prolog]$ /opt/gupu/yap-6/bin/yap -G 100m
Terminated
loops, while -G 90m works.
Better SWI-compatibility : no space between -G and number (maybe rather dicuss with Jan).
37: Ft! resource error missing
 [ulrich@gupu yap-prolog]$ /opt/gupu/yap-6/bin/yap
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
 % reconsulted /home/ulrich/.yaprc in module user, 0 msec 216 bytes
   ?- N is 1024*1024*50*4,functor(F,f,N),false.
 
     ERROR!!
     TYPE ERROR- functor/3: expected integer, got 209715200
   ?-
36: * better message needed
In case of a resource exhaustion due to too many open files, I get:
     ERROR at  clause 4 of prolog:open/3 !!
     SYSTEM ERROR- new stream not available for open/3
   ?- use_module(library(clpfd)).
     ERROR!!
     PERMISSION ERROR- use_module(user:library(clpfd)): cannot read from library(clpfd)
   ?- use_module(library(clpfd)).
It would be nice to get a clearer error message here.
35: F! C-c interupts have no effect
   ?- catch(call_cleanup((repeat,fail),true),x,fail).
Action (h for help): a
no
   ?- repeat, catch(call_cleanup(functor(F,f,10000000),throw(x)),x,fail).
Action (h for help): a
 
   ?- cblam(C),C, fail.
Action (h for help): a
 
cblam(true).
cblam(call_cleanup(C,C)) :- cblam(C).
2009-06-03 14:24:51 (CEST Wed): Sometimes C-c needs another C-c to get a prompt.
34: ! cleanup and findall (was #1)
   ?- call_cleanup(findall(a,repeat,_),write(cleanup)).
%
%
% YAP OOOPS: tried to access illegal address 0x7fff53c!!!!.
%
%
2688KB of Code Space (0x2000000--0x22a0190)
  Current hole: 0x7cdd000--0x815d000
95489KB of Global Stack (0x22bf000--0x7fff548)
1KB of Local Stack (0xdf609a0--0xdf61000)
0KB of Trail (0xdf61004--0xdf61084)
Performed 3 garbage collections
%
%
% YAP OOOPS: tried to access illegal address 0x7fff548!!!!.
commit 0cd9009132714f75418bc4e3eacd5828d24d116e Tue May 5 10:15:34 2009 -0500
33: * bad silent failure
   ?- M = a, M:c:(X=1).
M = a,
X = 1 ? ;
no
   ?- M:c:(X=1).
no
By simply removing a binding we cannot obtain failure! An instantiation error would be acceptable - or something pending if you insist.
32: *
Old(?) compiler warnings
31: * clpfd: no answer substitution
   ?- length(Xs,3), Xs ins 1..3.
Xs = [_A,_B,_C] ? ;
no
Expected: _A in 1..3 etc.
30: * make problem
make[1]: Leaving directory `/a4tmp/gupu/src/yap-6/arch/library/matrix'
(cd packages/PLStream; make)
make[1]: Entering directory `/a4tmp/gupu/src/yap-6/arch/packages/PLStream'
make[1]: *** No rule to make target `pl-buffer.o', needed by `plstream.so'. Stop.
make[1]: Leaving directory `/a4tmp/gupu/src/yap-6/arch/packages/PLStream'
make: *** [all] Error 2
a4:/opt/gupu/src/yap-6/arch> ls -l config.status
-rwxr-xr-x 1 ulrich prolog 39388 May  2 20:50 config.status
29: * freeze(X,X) incorrect
Probably related to toplevel:
   ?- freeze(X,X).
     ERROR at  clause 1 of prolog:'$clean_call'/1 !!
     INSTANTIATION ERROR- call/1: expected bound value
28: * call_residue_vars/2 and copy_term/3 needed
Instead of call_residue/2. It is a more efficient and more honest interface. call_residue/2 pretends more than it is able to provide. Compatibility: SWI and SICStus 4.
27: Q ^ incorrect
   ?- X is 2^ -1.
X = 2 ?
yes
Should yield most probably an evaluation_error(Something). (In SWI, this yields a float value.) Please note that some negative exponents do make sense!
Now:
   ?- E in -8..8, (E^E)^E#=E^E^E, labeling([],[E]).
     ERROR!!
     TYPE ERROR- : expected integer, got -1.0
   ?-
26: ! commandline flag -l and clpfd
The system hangs when invoked with -l item26.pl, which contains only :- use_module(library(clpfd)):
[ulrich@gupu yap-prolog]$ cat item26.pl
:- use_module(library(clpfd)).
[ulrich@gupu yap-prolog]$ /opt/gupu/yap-6/bin/yap -l item26.pl
% Restoring file /opt/gupu/yap-6/lib/Yap/startup
YAP version Yap-6.0.0
PL_register_foreign_in_module called with non-implemented flag 24 when
creating predicate (null):swi_stream_property/2
Happens on g3 (~ Debian 4.0, 64 bit) and gupu (very old Redhat 7.1).
Now changed to;
[ulrich@gupu yap-prolog]$ /opt/gupu/yap-6/bin/yap -l item26.pl
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
 % reconsulting /home/ulrich/.yaprc...
 % reconsulted /home/ulrich/.yaprc in module user, 0 msec 216 bytes
PL_register_foreign_in_module called with non-implemented flag 24 when creating predicate (null):swi_stream_property/2
 % reconsulting /home/ulrich/.yaprc...
 % reconsulted /home/ulrich/.yaprc in module user, 0 msec 216 bytes
 % reconsulting /home/ulrich/.yaprc...
 % reconsulted /home/ulrich/.yaprc in module user, 0 msec 216 bytes
 % reconsulting /home/ulrich/.yaprc...

2009-05-18 changed to
   ?- a4:~/ftp/yap-prolog> /opt/gupu/yap-6/bin/yap -l item26.pl
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
PL_register_foreign_in_module called with non-implemented flag 24 when creating predicate (null):swi_stream_property/2
(LOOPING)
25: * exponentiation/portability
   ?- 2#=C^D,D= -1, C=2.
C = 2,
D = -1 ? ;
Should fail. Rather due to particular implementation. (i3a#278)
24: * Bad syntax
   ?- X = 1\/3.
X = 1'\\/'3 ?
Expected: Same term as input.
23: !P DCGs: | missing
   ?- phrase(("a"|"b"),Xs).
     ERROR!!
     EXISTENCE ERROR- procedure |/4 is undefined, called from context  prolog:$enter_top_level/0
                 Goal was user:|([97],[98],_1048619,[])
2009-05-18: still missing, but now anser is just no This is for SWI compatibility.
22: *P timeout+nondeterminism
   ?- time_out(length(_,N),100,R).
N = 0,
R = success ? ;
no
This should produce (as in SICStus):
| ?- time_out(length(_,N),100,R).
N = 0,
R = success ? ;
N = 1,
R = success ? ;
N = 2,
R = success ?
Further, time_out(length(_,N),1000,R), R \== success. should never succeed (provided 1000 is large enough).
21: f incorrect timeout+cleanup
Minimum:
   ?- length(_,N),time_out(call_cleanup((repeat,false),true),100,F).
F = success,
N = 0 ?
(Now loops!)
   ?- length(_,N),time_out((repeat,open('/dev/null',read,S),call_cleanup(true,close(S)),false),100,F), N mod 10=:=0.
F = time_out,
N = 0 ? ;
F = time_out,
N = 10 ? ;
F = time_out,
N = 20 ? ;
F = time_out,
N = 30 ? ;
F = success,
N = 40,
S = '$stream'(29) ?
It is an impossibility that above time_out produces a success. Still this happens somehow.
Now better, but resource exhaustion due to missing setup_call_cleanup!
   ?- length(_,N),time_out((repeat,open('/dev/null',read,S),call_cleanup(true,close(S)),false),100,F), N mod 10=:=0.
F = time_out,
N = 0 ? ;
F = time_out,
N = 10 ? ;
F = time_out,
N = 20 ? ;
F = time_out,
N = 30 ? ;
F = time_out,
N = 40 ? ;
F = time_out,
N = 50 ? ;
F = time_out,
N = 60 ? ;
F = time_out,
N = 70 ? ;
F = time_out,
N = 80 ? ;
F = time_out,
N = 90 ? ;
F = time_out,
N = 100 ? ;
     ERROR at  clause 4 of prolog:open/3 !!
     SYSTEM ERROR- new stream not available for open/3
Moved to #60.
20: * OOPS
[ulrich@gupu yap-6]$ /opt/gupu/yap-6/bin/yap
% Restoring file /opt/gupu/yap-6/lib/Yap/startup
YAP version Yap-6.0.0
   ?- use_module(library(clpfd)).
 % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl...
PL_register_foreign_in_module called with non-implemented flag 24 when creating predicate (null):swi_stream_property/2
 % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 680 msec 824960 bytes
yes
   ?- E in -8..8, (E^E)^E#=E^E^E, labeling([],[E]).
E = -1 ? ;
E = 1 ? ;
E = 2 ? ;
%
%
% YAP OOOPS: tried to access illegal address (nil)!!!!.
%
%
1904KB of Code Space (0x2000000--0x21dc190)
4114KB of Global Stack (0x221e000--0x2622a24)
0KB of Local Stack (0x26e3c48--0x26e4000)
2KB of Trail (0x26e4004--0x26e4a18)
Performed 1 garbage collections
Running code at clause 1 of attributes:woken_att_do/2
Continuation is at clause 1 of attributes:woken_att_do/2
  clause 1 of attributes:woken_att_do/2
  clause 2 of prolog:$execute_woken_system_goals/1
  clause 1 of prolog:$wake_up_goal/2
     indexing code of prolog:$handle_throw/3 (*)
  clause 20 of clpfd:run_propagator/2
  meta-call
 
   Exiting ....
Expected: false/no, as in SWI.
19: * GMP-bug
On 32-bit:
?- X is 13^1150000000.
Segmentation fault
On 64-bit X is 235^2^61.

The problem is that the overflow happens effectively in the word to represent the size. Sometimes looping, or even havoc effects possible (with small effort). This problem has nothing to do with YAP or SWI. It is a general problem that requires a joint effort. Something for the Prolog commons?


Now:
   ?- X is 13^1150000000.
 
%
%
% YAP OOOPS: tried to access illegal address 0x5c73626f!!!!.
%
%
1080KB of Code Space (0x2000000--0x210e190)
4096KB of Global Stack (0x212e000--0x252e0d8)
0KB of Local Stack (0x25f5e9c--0x25f6000)
0KB of Trail (0x25f6004--0x25f6018)
Performed 1 garbage collections
Running code at meta-call
Continuation is at clause 4 of prolog:$query/2
  clause 4 of prolog:$query/2
  clause 2 of prolog:$command/4
  clause 6 of prolog:$enter_top_level/0
     indexing code of prolog:$catch/3 (*)
  clause 1 of prolog:$system_catch/4
  meta-call
 
   Exiting ....
35.590u 0.740s 0:42.91 84.6%    0+0k 0+0io 430pf+0w

Now 2015-01-28 01:45:26 (CET Wed):
 ?- X is 235^2^61.
gmp: overflow in mpz type
Aborted (core dumped)
18: ! bignum display
on 32 bit:
   ?- X is 7^7^7.
X =  ?
Expected:
   ?- X is 7^7^7.
X = 375...
Now Yap-6.0.0.0-8-g2020a19 on 64 bit, on 32 bit the same with 7^7^6
[ulrich@gupu yap-prolog]$ yap-6 -f none
% Restoring file /opt/gupu/yap-6/lib/Yap/startup.yss
YAP version Yap-6.0.0
   ?- (true;true), X is 7^7^6.
X = 0 ? ;
X = 869580...
17: *P further old gcc adaptations (^#7)
Version 5, Version 6
Version 6 (git clone git://yap.dcc.fc.up.pt/yap-6)
16: * OOPS
g3> /opt/gupu/Yap-5.1.2/bin/yap
% Restoring file /opt/gupu/Yap-5.1.2/lib/Yap/startup
YAP version Yap-5.1.2
   ?- length(_,N),functor(F,f,N),catch(F,_,write('caught ')),write(N),nl,false.
%
%
% YAP OOOPS: tried to access illegal address 0x61e000!!!!.
%
%
5733KB of Code Space (0x8800000--0x8d997a0)
430KB of Global Stack (0x8dd4000--0x8e3f998)
1KB of Local Stack (0x8f5fb18--0x8f60000)
0KB of Trail (0x8f60008--0x8f60080)
Performed 0 garbage collections
Running code at clause 1 of prolog:catch/3
Continuation is at clause 1 of prolog:catch/3
     indexing code of prolog:$catch/3 (*)
  clause 1 of prolog:catch/3
  clause 13 of prolog:$call/4
  clause 3 of prolog:$call/4
     indexing code of prolog:$$_length1/3 (*)
  clause 4 of prolog:$query/2
  clause 2 of prolog:$command/3
  clause 6 of prolog:$enter_top_level/0
     indexing code of prolog:$catch/3 (*)
  clause 1 of prolog:$system_catch/4
  meta-call
 
   Exiting ....
15: *
   ?- catch(X is 1 << 400000000,Pat,true).
Pat = error(evaluation_error(int_overflow),['is/2'|local_sp(142752004,142893492,[],[])]) ?
yes
C.f. 7.1.2 NOTES 1
When bounded is false, expressions with an integer value
will not have a value int_overflow, but might produce a resource
error (7.12, 7.12.2 h) because of exhaustion of resources.
14: *! git describe needed
Similar to SWI.
[ulrich@gupu yap]$ git describe
fatal: cannot describe '720c9a6b611f712220be553e32c224a3902af06d'
[ulrich@gupu yap]$ cd ../pl-57x/
[ulrich@gupu pl-57x]$ git describe
V5.7.8-15-gc8a094b
13: *P Minor doc changes
Formatted as gitpatch and regular diff

Biggest change is a more concrete description of term_variables/2 and some ISO corrections.

12: F clpfd:strange messages
g1:~/ftp/yap-prolog> /opt/gupu/yap/bin/yap
% Restoring file /opt/gupu/yap/lib/Yap/startup
YAP version Yap-5.1.4
   ?- use_module(library(clpfd)).
 % reconsulting /opt/gupu/yap/share/Yap/clpfd.pl...
...
% Warning:  at file /opt/gupu/yap/share/Yap/swi.yap, near line 42.
% Importing private predicate terms:term_variables/2 to swi.
% Warning:  at file /opt/gupu/yap/share/Yap/swi.yap, near line 42.
% Importing private predicate terms:term_variables/3 to swi.
     ERROR!!  at file /opt/gupu/yap/share/Yap/swi.yap, near line 115.
     PERMISSION ERROR- in line 115, system predicate term_variables/2: modifying static procedure term_variables/2
     ERROR!!  at file /opt/gupu/yap/share/Yap/swi.yap, near line 118.
     PERMISSION ERROR- in line 118, system predicate term_variables/3: modifying static procedure term_variables/3
  % reconsulted /opt/gupu/yap/share/Yap/swi.yap in module swi, 12 msec 464128 bytes
  % reconsulting /opt/gupu/yap/share/Yap/gensym.yap...
  % reconsulted /opt/gupu/yap/share/Yap/gensym.yap in module gensym, 0 msec 5504 bytes
     ERROR!!  at file /opt/gupu/yap/share/Yap/clpfd.pl, near line 3526.
     PERMISSION ERROR- consult: modifying static procedure lists:numlist/3
 % reconsulted /opt/gupu/yap/share/Yap/clpfd.pl in module clpfd, 32 msec 1281568 bytes
yes
Now:
[ulrich@gupu yap-6]$ /opt/gupu/yap-6/bin/yap
% Restoring file /opt/gupu/yap-6/lib/Yap/startup
YAP version Yap-6.0.0
   ?- use_module(library(clpfd)).
 % reconsulting /opt/gupu/yap-6/share/Yap/clpfd.pl...
PL_register_foreign_in_module called with non-implemented flag 24 when creating predicate (null):swi_stream_property/2
 % reconsulted /opt/gupu/yap-6/share/Yap/clpfd.pl in module clpfd, 710 msec 824960 bytes
yes
../configure --prefix /opt/gupu/yap-6 --with-gmp --enable-couroutining
11: D clpfd-documentation missing
10: * numlist/3
?- numlist(1,1,[_,_|_]). loops. Failure expected.
9: fQ how to limit memory
How can I limit the memory useage? I want the following (Here, SWI-Prolog):
?- catch(length(L,L),Pat,true).
Pat = error(resource_error(stack), global).
I tried to limit datasize and limit -h datasize all under Debian. But I failed. It seems you are allocating the memory manually via mmap. For every requested memory, the /dev/zero device is opended, mmapped, and closed. This leads to a quite arbitrary inefficient memory layout (see /proc/${PROCID}/maps), which makes the TLB crawl. This, you will only notice on a machine with many processes running. And you can only measure it via total throughput! All the OS's statistics have difficulties taking into account the TLB... The best would be to have one map for the user data. I.e. the heap segment. Then, the OS can do the best it knows, whatever that is. Alternatively, use mremap.
8: *^ makeinfo problem ^#13
g1:/opt/gupu/src/yap/docs> make info
makeinfo yap.tex
yap.tex:8701: Unknown command `geq'.
yap.tex:8701: Misplaced {.
yap.tex:8701: Misplaced }.
makeinfo: Removing output file `/opt/gupu/src/yap/docs/yap.info' due to errors; use --force to preserve.
make: *** [yap.info] Error 1
g1:/opt/gupu/src/yap/docs> makeinfo --version
makeinfo (GNU texinfo) 4.8
 
Copyright (C) 2004 Free Software Foundation, Inc.
There is NO warranty.  You may redistribute this software
under the terms of the GNU General Public License.
For more information about these matters, see the files named COPYING.
g1:/opt/gupu/src/yap/docs>
7: * GCC-problem
gcc -c -DBP_FREE -O3 -fomit-frame-pointer -Wall -Wstrict-prototypes -Wmissing-prototypes -DCOROUTINING=1 -DRATIONAL_TREES=1 -DDEPTH_LIMIT=1 -DHAVE_CONFIG_H -I. -I../H -I../OPTYap -I../BEAM -I../MYDDAS ../C/exec.c -o exec.o
../C/exec.c: In function `p_clean_ifcp':
../C/exec.c:1812: parse error before `pt0'
../C/exec.c:1814: `pt0' undeclared (first use in this function)
../C/exec.c:1814: (Each undeclared identifier is reported only once
../C/exec.c:1814: for each function it appears in.)
make: *** [exec.o] Error 1
100.290u 4.750s 1:45.44 99.6%   0+0k 0+0io 29776pf+0w
[ulrich@gupu arch]$ gcc --version
2.96
[ulrich@gupu arch]$ uname -a
Linux gupu.complang.tuwien.ac.at 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown
[ulrich@gupu arch]$ cat /etc/issue
 
Red Hat Linux release 7.1 (Seawolf)
Kernel 2.4.2-2 on an i686
[ulrich@gupu arch]$ history
     1  20:42   cd /opt/gupu/src/yap
     2  20:42   mkdir /opt/gupu/src/yap
     3  20:42   cd /opt/gupu/src/yap
     4  20:42   ls
     5  20:42   cvs -d :pserver:anonymous@yap.cvs.sf.net:/cvsroot/yap login
     6  20:43   cvs -z3 -d:pserver:yap.anonymous@yap.cvs.sf.net:/cvsroot/yap co .
     7  20:43   mkdir arch
     8  20:43   cd arch
     9  20:43   ../configure --prefix /opt/gupu/yap --with-gmp --enable-couroutining
    10  21:59   ../configure --prefix /opt/gupu/yap --with-gmp --enable-couroutining
    11  22:02   make
    12  22:07   gcc --version
    13  22:07   uname -a
    14  22:08   cat /etc/issue
    15  22:08   history
6: * incorrect interrupts and CLPFD
A long clpfd-propagation is interrupted with C-c. Then, the query is re-issued. Now failure is instantaneous for all queries.
   ?- abs(X)#< 10000000, X#>Y,Y#>X.
Action (h for help): a
% YAP execution aborted.
   ?- abs(X)#< 10000000, X#>Y,Y#>X.
no
   ?- X#>Y,Y#>X.
 
no
   ?- X#>Y.
no
   ?- X#>1.
no
   ?- 2#>1.
no
   ?-
5: * ^/2: result type integer missing
g1:/opt/gupu/src/yap> /opt/gupu/yap/bin/yap
% Restoring file /opt/gupu/yap/lib/Yap/startup
YAP version Yap-5.1.4
   ?- X is 2^2.
X = 4.0 ?
yes
Should be an integer. ** is exponentiation producing floats (9.3.1). ^ is not yet defined. But it makes sense to make this a function to the integers. (I thought you agreed on this some time ago, but probably my memory is failing).

Compatibility: SWI produces integers with ^ for two integer arguments (but it produces them also for **).

4: * reading ~/startup
This is very unintuitive. I have my own startup script which has nothing to do with Prolog in my home ... "yap-startup" or whatever might be preferable. It is .plrc pl.ini in SWI.
3: *! setup_call_cleanup/3 needed
setup_call_cleanup(Setup, Call, Cleanup) :-
   Setup,
   call_cleanup(Call, Cleanup).
The difference to call_cleanup/2 is that setup_call_cleanup/3 is able to provide provisions for handling interrupts/timeouts and other asynchronous signals during Setup in a more robust fashion. Consider:
file_term(File, Term) :-
   setup_call_cleanup(
      open(File, read, Stream),
      ( repeat, read(Stream, Term), ( Term == end_of_file -> ! ; true ) ),
      close(Stream)).
The idea is to read the file term-by-term. At the end, or when the caller is satisfied, the stream is closed. But what happens, if there is an interrupt immediately after the goal open/3? The cleanup handler might not be installed at that very moment - and the Stream is never closed thereby using system resources.

Most uses of call_cleanup/2 are better handled by setup_call_cleanup/3. In many applications it is not a big problem, if something leaves some files open in case of errors, but in some like servers it is a big problem.

2: * call_cleanup/2: priorities for multiple exceptions
   ?- call_cleanup(throw(goal_exception),throw(cleanup_exception)).
     ERROR!! [Thread 0 ]
     cleanup_exception

Rationale: The exception of the Goal is most probably more important, as it is the first to happen. The exception of Cleanup might be a consequence of the first exception. It is therefore more robust to pass goal_exception and not cleanup_exception further to the top. Consider a file-system overflow: In this situation it is best to get the very first exception/error than any of the followups. (This is in contrast to Common Lisp's unwind-protect. However, Common Lisp's catch and throw is much more powerful than ISO Prolog's. Yet, as default-behaviour it is quite controversial.)

(Compatibility: Currently SWI, but not SICStus.)

1: F call_cleanup/2: Lost cleanup exception

YAP version Yap-5.1.4
   ?- call_cleanup((X=1;X=2),(write(cleanup(X,Y)),nl)),Y=bound,throw(x).
     ERROR!! [Thread 0 ]
     x
New problem:
[ulrich@gupu yap-6]$ /opt/gupu/yap-6/bin/yap
% Restoring file /opt/gupu/yap-6/lib/Yap/startup
YAP version Yap-6.0.0
   ?- call_cleanup((X=1;X=2),(write(cleanup(X,Y)),nl)),Y=bound,throw(x).
cleanup(_1048612,_1048622)
[ulrich@gupu yap-6]$
Expected:
   ?- call_cleanup((X=1;X=2),(write(cleanup(X,Y)),nl)),Y=bound,throw(x).
cleanup(_1055,_1070)
     ERROR!! [Thread 0 ]
     x
I.e., the cleanup should be executed, even in this situation. All bindings of X and Y should have been undone already.

(Compatibility: SICStus, partially SWI (which incorrectly shows bindings))

Further problem:

   ?- catch((call_cleanup((X=1;X=2),(write(cleanup(X,Y)),nl)),Y=bound,throw(x)),Pat,(write(got(Pat)),nl)).
cleanup(_1048612,_1048622)
So the exception is not caught.

   ?- call_cleanup((catch((call_cleanup((X=1;X=2),(write(cleanup(X,Y)),nl)),Y=bound,throw(x)),Pat,(write(got(Pat)),nl))),throw(throwing-the-cleanupper)).
   ?- call_cleanup((catch((call_cleanup((X=1;X=2),(write(cleanup(X,Y)),nl)),Y=bound,throw(x)),Pat,(write(got(Pat)),nl))),(write(i-am-the-cleanupper),nl)).
   ?- catch((call_cleanup((X=1;X=2),true),throw(x)),Pat,true),false.
Pat = x ? ;
   ?- call_cleanup(call_cleanup((X=1;X=2),true),Det=est).
finis
[ICO]NameLast modifiedSizeDescription

[PARENTDIR]Parent Directory  -  
[TXT]0001-Correct-dir-formatting-for-Info-including-special-ch.patch2009-05-02 18:41 1.2K 
[TXT]0001-Minor-doc-changes-Item-13.patch2009-03-26 03:02 22K 
[TXT]0001-Old-gcc-adaptations-for-yap-6.patch2009-04-29 01:54 4.1K 
[TXT]0002-Further-changes-for-old-GCC.patch2009-04-28 16:42 2.4K 
[TXT]Item.html2023-12-23 10:04 53K 
[TXT]YAP-HEADER.html2023-12-23 10:08 200K 
[   ]a2009-06-02 02:45 1  
[TXT]blam.pl2009-05-20 00:58 466  
[   ]blam.xwam2009-05-20 01:09 970  
[TXT]fastunification-2.pl2009-05-18 03:02 332  
[TXT]fastunification.pl2009-05-14 16:44 332  
[TXT]freezetest.pl2007-07-13 13:51 214  
[DIR]git/2012-07-28 13:43 -  
[TXT]item9-maps.txt2009-03-24 00:04 12K 
[TXT]item13.patch.txt2009-03-24 21:18 21K 
[TXT]item26.pl2009-05-02 02:56 31  
[DIR]item30/2009-05-02 21:43 -  
[TXT]item32.html2009-05-04 18:10 39K 
[TXT]item49.pl2009-05-15 15:52 329  
[TXT]item53.pl2009-05-18 02:17 16  
[TXT]item115.txt2009-06-04 00:40 1.9K 
[TXT]item116.html2009-06-04 03:45 3.3K 
[DIR]item120/2009-06-09 00:41 -  
[TXT]item130.html2009-06-17 06:57 17K 
[   ]item133.tar2009-06-14 04:21 10K 
[DIR]item133/2009-06-14 04:24 -  
[TXT]item138.pl2009-06-18 05:51 361  
[TXT]item296.txt2015-01-26 01:01 461  
[TXT]lcotest.pl2009-05-25 22:53 48K 
[DIR]library/2016-02-27 23:47 -  
[   ]maps.12009-03-24 00:04 11K 
[   ]maps.32009-03-24 00:19 0  
[TXT]perfcomp_yap.pl2015-07-03 15:49 1.2K 
[TXT]timeouts_in_yap.txt2009-06-04 00:29 4.0K 
[TXT]yaplog.txt2009-07-10 17:02 2.3K 

Apache/2.4.62 (Debian) OpenSSL/3.0.15 Server at www.complang.tuwien.ac.at Port 80