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).

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
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
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.
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
286: * documentation
Deprecate C-Prolog specfic file I/O. That is, tell/0 etc.
284: *
 ?- _=..[1|_].
     ERROR!!
     TYPE ERROR- (=..)/2: expected atom, got 1
 ?- a=..[a|a].
false.
Expected: instantiation_error, and type_error(list,[a|a])
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 )).
271: * Prolog prologue
How to provide the Prolog prologue in YAP?
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!
264: * toplevel problem
?- true ; true.
yes
Expected: Two answers by default. Otherwise you cannot easily detect accidental choice points.
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), []).
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.
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.
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
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
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
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...
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)
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)
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.
227: * syntax deviation
The complete syntax issues are here.
225: * incorrect toplevel
?- X = (:-).
X = :-
Expected: X = (:-)
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
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.
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.
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.).
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.
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.
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| ...]).
182: * gitourious: git objects too large
I cannot use gitorious anymore, it seems that all interesting changes are "too large". Like this.
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), ...
Below are the WG17 Edinburgh changes
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
167: *A Wrong meta call
 ?- call(((C=!;C=true), C)).
C = !.
Expected: Two solutions.
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.
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!!
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!
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.
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
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 = [] ?
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.
Yap-6.0.0.0-138-g7ffbfdb
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}...
Yap-6.0.0.0-125-gb5a5e10
115: * current gcc warnings
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).
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.
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
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?
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
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!
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.
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.
Yap-6.0.0.0-64-g43e9e9f 2009-05-27 00:36:40 (CEST Wed)
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.)
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.
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
63: * Targets for setup_call_cleanup/3
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.
Yap-6.0.0.0-2-g13b9098
commit 17e36dbda17b6a6a2551682b464d9d5bcd417c8b 2009-05-18 -#31
54: *m enforcing 32-bit mode on 64-bit?
Ideally as a configure option. Many errors are easier to observe under 32 bit.
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
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)
...
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).
commit 0cd9009132714f75418bc4e3eacd5828d24d116e Tue May 5 10:15:34 2009 -0500
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)
Version 6 (git clone git://yap.dcc.fc.up.pt/yap-6)
../configure --prefix /opt/gupu/yap-6 --with-gmp --enable-couroutining
11: D clpfd-documentation missing
finis
Validated HTML