number_chars/2 extensively
after #28, #27, #19, #17,
% ugly hack because of unaddressed flowlog-prolog#19 glength([],0). glength([_|L],N1) :- glength(L,N2), N1 is N2+1. abs([]). abs([C|Cs]) :- ( C = a ; C = b ), abs(Cs). ?- length(L,16),(X=1;X=2),( abs(L), fail ; true ). L = [_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15], X = 1 ; % unexpected output ; L = [_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15], X = 2. ?- glength(L,N), N > 14, ( abs(L), fail ; true ). L = [_0,_2,_4,_6,_8,_10,_12,_14,_16,_18,_20,_22,_24,_26,_28], N = 15 ; % unexpected output ; L = [_0,_2,_4,_6,_8,_10,_12,_14,_16,_18,_20,_22,_24,_26,_28,_30], N = 16 ; % unexpected output ; L = [_0,_2,_4,_6,_8,_10,_12,_14,_16,_18,_20,_22,_24,_26,_28,_30,_32], N = 17 ; % unexpected output ; L = [_0,_2,_4,_6,_8,_10,_12,_14,_16,_18,_20,_22,_24,_26,_28,_30,_32,_34], N = 18 ; % unexpected output ; L = [_0,_2,_4,_6,_8,_10,_12,_14,_16,_18,_20,_22,_24,_26,_28,_30,_32,_34,_36], N = 19 ; ... . ?- glength(L,N), N > 14, countall(abs(L),Cnt). L = [_0,_2,_4,_6,_8,_10,_12,_14,_16,_18,_20,_22,_24,_26,_28], N = 15, Cnt = 32768 ; % unexpected output ; L = [_0,_2,_4,_6,_8,_10,_12,_14,_16,_18,_20,_22,_24,_26,_28,_30], N = 16, Cnt = 65536 ; % unexpected output ; L = [_0,_2,_4,_6,_8,_10,_12,_14,_16,_18,_20,_22,_24,_26,_28,_30,_32], N = 17, Cnt = 131072 ; % unexpected output ; L = [_0,_2,_4,_6,_8,_10,_12,_14,_16,_18,_20,_22,_24,_26,_28,_30,_32,_34], N = 18, Cnt = 262144 ; % unexpected output ; L = [_0,_2,_4,_6,_8,_10,_12,_14,_16,_18,_20,_22,_24,_26,_28,_30,_32,_34,_36], N = 19, Cnt = 524288 ; ... . ?- glength(L,N), N > 13, countall(abs(L),Cnt). L = [_0,_2,_4,_6,_8,_10,_12,_14,_16,_18,_20,_22,_24,_26], N = 14, Cnt = 16384 ; L = [_0,_2,_4,_6,_8,_10,_12,_14,_16,_18,_20,_22,_24,_26,_28], N = 15, Cnt = 32768 ; % unexpected output ; L = [_0,_2,_4,_6,_8,_10,_12,_14,_16,_18,_20,_22,_24,_26,_28,_30], N = 16, Cnt = 65536 ; % unexpected output ; L = [_0,_2,_4,_6,_8,_10,_12,_14,_16,_18,_20,_22,_24,_26,_28,_30,_32], N = 17, Cnt = 131072 ; % unexpected output ; L = [_0,_2,_4,_6,_8,_10,_12,_14,_16,_18,_20,_22,_24,_26,_28,_30,_32,_34], N = 18, Cnt = 262144 ; ... .
l(0). l(N0) :- l(N1), N0 is N1+1. ?- l(N). N = 0 ; N = 1 ; N = 2 ; N = 3 ; N = 4Segmentation fault (core dumped)
nihil --> [].This is a valid term, even if you do not have any DCG support. It should be at least a fact.
?- N is 2^63, functor(_,f,N). error(type_error(integer,9223372036854775808),functor/3), unexpected. type_error(...,...), unexpected. % any type error is bad ?- N is 2^63, arg(N,f(1),_). error(type_error(integer,9223372036854775808),arg/3), unexpected. false. % expected, but not found
outputs/1 with a grammar
rule body as argument. To start with, a list of characters will do.
?- call((write(3), call(1)).
outputs("3"),
type_error(callable, 1).
Compare this to the original example in 7.8.3.4:
call((write(3), call(1)). Outputs '3', then type_error(callable, 1).So it's outputs not output. The comma has here the meaning and then. Answer constraints and answer substitutions come last in a leaf-answer. (Unclear, if there are situations to put them first. Maybe if constraints and side effects are involved. But this gets way too complex.)
?- Ch = t, put_char(Ch).
outputs("t"),
Ch = t.
?- length(L,N). % #1 error(existence_error(procedure,length/2),length/2), unexpected. L = [], N = 0 ; ... . % expected, but not found ?- length(2,0). % #4 error(type_error(list,2),length/2), unexpected. false. % expected, but not found
?- append("ab","cd",L).
false, unexpected.
L = "abcd". % expected, but not found
?- append([],Ys,Zs).
Segmentation fault (core dumped)
Ys = Zs. % expected, but not found
?- append("a",Ys,Zs).
false, unexpected.
?- member(X,"a").
false, unexpected.
?- member(X,[a]).
X = a.
?- [X] = "a".
X = a.
cons([_|_]).
?- cons("a").
false, unexpected.
?- append([a], Ys, Zs).(above with default. Does work with interp. With wam:)Segmentation fault (core dumped), unexpected. Zs = [a|Ys]. % expected, but not found Ys = _1, Zs = [a|_2], unexpected.
?- append([a], Ys, Zs). Ys = Xs, Zs = [a|Xs], unexpected. % no longer Ys = _1, Zs = [a|_2], unexpected. % new
Xs come from?ulrich@p0:/tmp$ git clone https://git.liminal.cafe/byakuren/flowlog.git Cloning into 'flowlog'... fatal: unable to access 'https://git.liminal.cafe/byakuren/flowlog.git/': gnutls_handshake() failed: Handshake failed ulrich@p0:/tmp$ cat /etc/issue Ubuntu 14.04.6 LTS \n \lThis does not happen with github. There I follow various systems like Scryer, Trealla.
ulrich@p0:/opt/gupu/flowlog$ make cc -O2 -Wall -Wextra -pthread flowlog.c -lm -o flowlog flowlog.c:41:23: fatal error: stdatomic.h: No such file or directory #include^ compilation terminated. make: *** [flowlog] Error 1 ulrich@p0:/opt/gupu/flowlog$ cc --version cc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
wget https://web.liminal.cafe/~byakuren/flowlog/flowlog.tar.gzgit clone https://git.liminal.cafe/byakuren/flowlog.git make
| Name | Last modified | Size | Description | |
|---|---|---|---|---|
| Parent Directory | - | |||
| name.txt | 2026-01-05 11:38 | 8 | ||
| lr.pl | 2026-01-06 20:51 | 343 | ||
| gfl.pl | 2026-06-17 14:41 | 40 | ||
| FLOWLOG-HEADER.html | 2026-06-22 11:09 | 19K | ||