• How hard is PIP-0110 to implement? (Was: Does Scryer Prolog have all tricks up its sleeves?)

    From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Sun Apr 26 22:43:16 2026
    From Newsgroup: comp.lang.prolog

    Hi,

    Now I was testing:

    ?- format("~`*t NICE TABLE ~`*t~61|~n", []),
    format("*~t~d~20|~t~d~t~40|~d~t~40|~t*~61|~n", [123,45,678]).

    There is quite some discrepancy among Prolog systems:

    /* SWI-Prolog 10.1.5 */
    ************************ NICE TABLE *************************
    * 123 45 678 *

    /* Scryer Prolog 0.10 */
    ************************ NICE TABLE *************************
    * 123 45 678 *

    /* Trealla Prolog 2.94.3 */
    ************************ NICE TABLE ************************
    * 123 45 678 *

    Expected output would be, yes we can do it!

    /* Dogelog Player 2.2.2 */
    ************************ NICE TABLE *************************
    * 123 45 678 *


    See also:
    https://prolog-lang.org/ImprovementsForum/0110-format.html

    Bye

    Mild Shock schrieb:
    Hi,

    Thats a nice test case, failed by Trealla Prolog
    and Scryer Prolog. Currently working on fixing it
    for Dogelog Player and Jekejeke Prolog:

    /* SWI-Prolog 9.3.26 */

    % ?- member(N,[5,10,15]), time(test3(N)), fail; true.
    % % 2,007 inferences, 0.000 CPU in 0.000 seconds (0% CPU, Infinite Lips)
    % % 2,012 inferences, 0.000 CPU in 0.000 seconds (0% CPU, Infinite Lips)
    % % 2,017 inferences, 0.000 CPU in 0.001 seconds (0% CPU, Infinite Lips)
    % true.

    /* Trealla Prolog 2.80.4 */

    % ?- member(N,[5,10,15]), time(test3(N)), fail; true.
    % % Time elapsed 0.001s, 3020 Inferences, 4.741 MLips
    % % Time elapsed 0.019s, 3030 Inferences, 0.159 MLips
    % % Time elapsed 0.511s, 3040 Inferences, 0.006 MLips
    %    true.

    /* Scryer Prolog 0.9.4-547 */

    % ?- member(N,[5,10,15]), time(test3(N)), fail; true.
    %    % CPU time: 0.002s, 7_120 inferences
    %    % CPU time: 0.053s, 7_135 inferences
    %    % CPU time: 1.657s, 7_150 inferences
    %    true.

    The test case:

    hydra(0, n) :- !.
    hydra(N, s(X,X)) :-
       M is N-1,
       hydra(M, X).

    hydra2(0, _) :- !.
    hydra2(N, s(X,X)) :-
       M is N-1,
       hydra2(M, X).

    test3(N) :-
       hydra(N,X), hydra2(1,Y),
       between(1,1000,_), unify_with_occurs_check(X, Y), fail; true.

    Mild Shock schrieb:
    Woa! This nonsense really made my day:

    https://github.com/mthom/scryer-prolog/discussions/3004

    It starts with, where somebody "tried" a declarative DCG
    using constraint logic programming:

    number_tail(0, 0) --> [].
    number_tail(Number, DigitsCount) -->
       ("," | ""),
       digit(Digit),
       number_tail(Digits, RestDigitsCount),
       {
         DigitsCount #= RestDigitsCount + 1,
         Number #= Digit * 10 ^ RestDigitsCount + Digits
       }.

    He then noticed that its not deterministic. And since
    it is not deterministic, clause ordering changes the
    result when onced via once/1.

    LoL

    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Mon Apr 27 10:50:33 2026
    From Newsgroup: comp.lang.prolog

    Hi,

    The PIP-0110 requires monotonicity:

    “~t has the same or one more
    space than all the preceding ones”

    Interestingly different approaches are seen in the wild:

    /* SWI-Prolog 10.1.5 */
    ?- format('~w~t~w~t~w~t~w~t~w~15|', [a,b,c,d,e]), nl.
    a b c d e
    true.

    /* Scryer Prolog 0.10 */
    ?- format("~w~t~w~t~w~t~w~t~w~15|", [a,b,c,d,e]), nl.
    a b c d e

    /* Dogelog Player 2.2.2 */
    ?- format('~w~t~w~t~w~t~w~t~w~15|', [a,b,c,d,e]), nl.
    a b c d e
    true.

    Both SWI-Prolog and Scryer Prolog would match
    the PIP-0110 spec, i.e. monotonic space increase,
    still they differ in their outcome.

    On the other hand Dogelog Player would not match
    the PIP-0110 spec, since it uses the floor
    Bresenham which is non-monotonic.

    BTW: Some Prolog systems fail to reach the 15 column,
    or do not support the rubber band respective column
    format specifier at all, only recognize the format

    specifiers but do not process them:

    /* Trealla Prolog 2.94.3 */
    ?- format('~w~t~w~t~w~t~w~t~w~15|', [a,b,c,d,e]), nl.
    a b c d e
    true.

    /* XSB Prolog 5.0beta */
    ?- format('~w~t~w~t~w~t~w~t~w~15|', [a,b,c,d,e]), nl.
    abcde

    Bye

    Mild Shock schrieb:
    Hi,

    Now I was testing:

    ?- format("~`*t NICE TABLE ~`*t~61|~n", []),
       format("*~t~d~20|~t~d~t~40|~d~t~40|~t*~61|~n", [123,45,678]).

    There is quite some discrepancy among Prolog systems:

    /* SWI-Prolog 10.1.5 */
    ************************ NICE TABLE ************************* *                123         45         678                    *

    /* Scryer Prolog 0.10 */
    ************************ NICE TABLE ************************* *                123         45         678                    *

    /* Trealla Prolog 2.94.3 */
    ************************ NICE TABLE ************************ *                123         45         678                 *

    Expected output would be, yes we can do it!

    /* Dogelog Player 2.2.2 */
    ************************ NICE TABLE ************************* *                123         45         678                 *


    See also:
    https://prolog-lang.org/ImprovementsForum/0110-format.html

    Bye
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Mon Apr 27 16:03:46 2026
    From Newsgroup: comp.lang.prolog

    Hi,

    Scryer Prolog would nevertheless fall over the
    cliff with its [2,2,2,4] progression, while other
    progressions like [1,2,3,4] would be not excluded,

    because of the local precendence based formulation,
    but mostlikely not desired and not considered
    evenly spaced anymore. On the other hand

    Dogelog Player would not match the PIP-0110 spec,
    since it uses the floor Bresenham which is non-
    monotonic. But Bresenham has a guarantee, although

    alternating, it obvisouly starts with floor(N/D)
    and can maximally reach floor(N+D-1/D), which is
    the same as ceiling(N/D), the difference between

    the two maximally 1. (*)

    Bye

    BTW: Was toying around with:

    % bresenham(+Integer, +Integer, -List)
    bresenham(N, D, L) :-
    length(L, D),
    bresenham(L, 0, N, D).

    % bresenham(+List, +Integer, +Integer, +Integer)
    bresenham([], _, _, _).
    bresenham([K|L], M, N, D) :-
    H is M+N,
    divmod(H, D, K, M2),
    bresenham(L, M2, N, D).

    But couldn't produce something chaotic leveing
    the -1, 0, +1 change regime around the same numbers:

    ?- bresenham(29, 5, X).
    X = [5, 6, 6, 6, 6].

    ?- bresenham(29, 8, X).
    X = [3, 4, 3, 4, 4, 3, 4, 4].

    (*) I was on the brink of testing an infinite
    universum, in hope of finding a pair (N, D)
    where bresenham/3 nevertheless shows

    a more chaotic behaviour, but then I resorted
    to mathematical induction, having a look into
    the infinite abyss with the tools that already

    Bernard Bolzano and Giuseppe Peano paved.

    Mild Shock schrieb:
    Hi,

    The PIP-0110 requires monotonicity:

    “~t has the same or one more
    space than all the preceding ones”

    Interestingly different approaches are seen in the wild:

    /* SWI-Prolog 10.1.5 */
    ?- format('~w~t~w~t~w~t~w~t~w~15|', [a,b,c,d,e]), nl.
    a  b  c   d   e
    true.

    /* Scryer Prolog 0.10 */
    ?- format("~w~t~w~t~w~t~w~t~w~15|", [a,b,c,d,e]), nl.
    a  b  c  d    e

    /* Dogelog Player 2.2.2 */
    ?- format('~w~t~w~t~w~t~w~t~w~15|', [a,b,c,d,e]), nl.
    a  b   c  d   e
    true.

    Both SWI-Prolog and Scryer Prolog would match
    the PIP-0110 spec, i.e. monotonic space increase,
    still they differ in their outcome.

    On the other hand Dogelog Player would not match
    the PIP-0110 spec, since it uses the floor
    Bresenham which is non-monotonic.

    BTW: Some Prolog systems fail to reach the 15 column,
    or do not support the rubber band respective column
    format specifier at all, only recognize the format

    specifiers but do not process them:

    /* Trealla Prolog 2.94.3 */
    ?- format('~w~t~w~t~w~t~w~t~w~15|', [a,b,c,d,e]), nl.
    a  b  c  d  e
       true.

    /* XSB Prolog 5.0beta */
    ?- format('~w~t~w~t~w~t~w~t~w~15|', [a,b,c,d,e]), nl.
    abcde

    Bye

    Mild Shock schrieb:
    Hi,

    Now I was testing:

    ?- format("~`*t NICE TABLE ~`*t~61|~n", []),
        format("*~t~d~20|~t~d~t~40|~d~t~40|~t*~61|~n", [123,45,678]).

    There is quite some discrepancy among Prolog systems:

    /* SWI-Prolog 10.1.5 */
    ************************ NICE TABLE *************************
    *                123         45         678                    *

    /* Scryer Prolog 0.10 */
    ************************ NICE TABLE *************************
    *                123         45         678                    *

    /* Trealla Prolog 2.94.3 */
    ************************ NICE TABLE ************************
    *                123         45         678                 *

    Expected output would be, yes we can do it!

    /* Dogelog Player 2.2.2 */
    ************************ NICE TABLE *************************
    *                123         45         678                 *


    See also:
    https://prolog-lang.org/ImprovementsForum/0110-format.html

    Bye

    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Wed Apr 29 00:38:06 2026
    From Newsgroup: comp.lang.prolog

    Hi,

    Thats was fun, maybe somebody did use the Stoic Grisu,
    no delusional digits, only zeros:

    /* Dogelog Player for Java, Dogelog Player for JavaScript */

    ?- between(95,105,N), format('~6f', [pi**N]), nl, fail; true. 169526621072093600000000000000000000000000000000.000000 532583587347989900000000000000000000000000000000.000000 1673160685434943000000000000000000000000000000000.000000 5256389317637680000000000000000000000000000000000.000000 16513434064698400000000000000000000000000000000000.000000 51878483143195920000000000000000000000000000000000.000000 162981061522046250000000000000000000000000000000000.000000 512020105551926600000000000000000000000000000000000.000000 1608558602092203000000000000000000000000000000000000.000000 5053435887201532000000000000000000000000000000000000.000000 15875837058619354000000000000000000000000000000000000.000000
    true.

    /* Dogelog Player for CPython, Scryer Prolog */

    ?- between(95,105,N), format("~6f", [pi**N]), nl, fail; true. 169526621072093604906820176085840076682051977216.000000 532583587347989896682185959640830761243896709120.000000 1673160685434943094521965146828670065372972449792.000000 5256389317637679918948413843353324366868288372736.000000 16513434064698399680249672647558109095601897472000.000000 51878483143195924744806997083865846970332907307008.000000 162981061522046250302000391689502574507182910341120.000000 512020105551926606134531253131181174736461909458944.000000 1608558602092203016045060452811678201001748662845440.000000 5053435887201532208668864202632055738347047857684480.000000 15875837058619353962143820726017670908628371861667840.000000
    true.

    /* SWI-Prolog */

    ?- between(95,105,N), format('~6f', [pi**N]), nl, fail; true. 169526621072093767166097005299203468260062265344.000000 532583587347990464589654861887602631766932717568.000000 1673160685434944717114733438962303981153075331072.000000 5256389317637684462208165061327499331052576440320.000000 16513434064698415257140248252040994687090885132288.000000 51878483143195987052369299501797389336288857948160.000000 162981061522046416455499864803986687483065445384192.000000 512020105551927104595029672474633513664109514588160.000000 1608558602092204677580055183956519330760574013276160.000000 5053435887201537525580847342295547353575288979062784.000000 15875837058619369912879770145008145754313095225802752.000000
    true.

    The Prolog systems with the delusional digits made my day,
    they even don't agree in the delusional digits itself.

    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Wed Apr 29 02:12:37 2026
    From Newsgroup: comp.lang.prolog

    Hi,

    Ok, leaving the beaten path of my Prolog system
    probing, and look at some newer beast.

    This looks bad:

    ?- format('~6f', [pi**14]), nl.
    9122171.18175435

    Expected result:

    ?- format('~6f', [pi**14]), nl.
    9122171.181754

    Bye

    BTW: Tested using this test tester:

    X-Machines Virtual Machine (XVM™) is a neurosymbolic virtual AI
    processor which combines neural processes with symbolic reasoning. https://aws.amazon.com/marketplace/pp/prodview-6luxq22pgmehe

    Mild Shock schrieb:
    See also:
    https://prolog-lang.org/ImprovementsForum/0110-format.html


    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Wed Apr 29 02:22:27 2026
    From Newsgroup: comp.lang.prolog

    Hi,

    The 9122171.18175435 is a little offending, what if one
    keeps a federal secret after the 6 fraction digit?

    Bye

    Mild Shock schrieb:
    Hi,

    Ok, leaving the beaten path of my Prolog system
    probing, and look at some newer beast.

    This looks bad:

    ?- format('~6f', [pi**14]), nl.
    9122171.18175435

    Expected result:

    ?- format('~6f', [pi**14]), nl.
    9122171.181754

    Bye

    BTW: Tested using this test tester:

    X-Machines Virtual Machine (XVM™) is a neurosymbolic virtual AI
    processor which combines neural processes with symbolic reasoning. https://aws.amazon.com/marketplace/pp/prodview-6luxq22pgmehe

    Mild Shock schrieb:
    See also:
    https://prolog-lang.org/ImprovementsForum/0110-format.html



    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Wed Apr 29 11:21:02 2026
    From Newsgroup: comp.lang.prolog

    Hi,

    Ross Finlayson schrieb:
    Or shaves pennies.

    X-Machines Virtual Machine (XVM™) is a neurosymbolic virtual AI
    processor which combines neural processes with symbolic reasoning.
    https://aws.amazon.com/marketplace/pp/prodview-6luxq22pgmehe

    Cost/hour: $200,000.00

    LoL

    Bye

    P.S.: If it could do some quant trading magic, one would
    possibly pay so much. But Logtalk is simply too lame:

    Version release notes
    XVM Engine v10.2.4 is the full engine capable of running
    all XVM and Logtalk programs, excluding for logtalk tools.

    Mild Shock schrieb:
    Hi,

    The 9122171.18175435 is a little offending, what if one
    keeps a federal secret after the 6 fraction digit?

    Bye

    Mild Shock schrieb:
    Hi,

    Ok, leaving the beaten path of my Prolog system
    probing, and look at some newer beast.

    This looks bad:

    ?- format('~6f', [pi**14]), nl.
    9122171.18175435

    Expected result:

    ?- format('~6f', [pi**14]), nl.
    9122171.181754

    Bye

    BTW: Tested using this test tester:

    X-Machines Virtual Machine (XVM™) is a neurosymbolic virtual AI
    processor which combines neural processes with symbolic reasoning.
    https://aws.amazon.com/marketplace/pp/prodview-6luxq22pgmehe

    Mild Shock schrieb:
    See also:
    https://prolog-lang.org/ImprovementsForum/0110-format.html




    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Thu Apr 30 17:49:31 2026
    From Newsgroup: comp.lang.prolog

    Hi,

    How it started:

    Trealla Prolog is being updated for the
    proposal (only failing some of the table
    related tests as of v2.85.19).

    How its going:

    The test case for ~r and ~R are useless.
    Very bad converage for a format/3 that does
    not have some Spaghetti logic. Big integer

    and negative numbers missing. Now I find:
    ```
    /* Trealla Prolog v2.94.3 */
    ?- format('~11R', [-7625597484987]), nl.
    %%% crash
    ```
    Main problem how does one get coverage
    without thinking? Copying from "ghost" Quintus
    manual doesn't assure coverage. Theoretically

    a coverage tool, that shows code coverage when
    a test suite is run, would help. Still it might
    not capture certain data points if the code

    doesn't have according branching. So it needs
    either more human effort or fuzz testing.

    https://de.wikipedia.org/wiki/Fuzzing

    Bye

    Mild Shock schrieb:
    Hi,

    Now I was testing:

    ?- format("~`*t NICE TABLE ~`*t~61|~n", []),
       format("*~t~d~20|~t~d~t~40|~d~t~40|~t*~61|~n", [123,45,678]).

    There is quite some discrepancy among Prolog systems:

    /* SWI-Prolog 10.1.5 */
    ************************ NICE TABLE ************************* *                123         45         678                    *

    /* Scryer Prolog 0.10 */
    ************************ NICE TABLE ************************* *                123         45         678                    *

    /* Trealla Prolog 2.94.3 */
    ************************ NICE TABLE ************************ *                123         45         678                 *

    Expected output would be, yes we can do it!

    /* Dogelog Player 2.2.2 */
    ************************ NICE TABLE ************************* *                123         45         678                 *


    See also:
    https://prolog-lang.org/ImprovementsForum/0110-format.html

    Bye

    Mild Shock schrieb:
    Hi,

    Thats a nice test case, failed by Trealla Prolog
    and Scryer Prolog. Currently working on fixing it
    for Dogelog Player and Jekejeke Prolog:

    /* SWI-Prolog 9.3.26 */

    % ?- member(N,[5,10,15]), time(test3(N)), fail; true.
    % % 2,007 inferences, 0.000 CPU in 0.000 seconds (0% CPU, Infinite Lips)
    % % 2,012 inferences, 0.000 CPU in 0.000 seconds (0% CPU, Infinite Lips)
    % % 2,017 inferences, 0.000 CPU in 0.001 seconds (0% CPU, Infinite Lips)
    % true.

    /* Trealla Prolog 2.80.4 */

    % ?- member(N,[5,10,15]), time(test3(N)), fail; true.
    % % Time elapsed 0.001s, 3020 Inferences, 4.741 MLips
    % % Time elapsed 0.019s, 3030 Inferences, 0.159 MLips
    % % Time elapsed 0.511s, 3040 Inferences, 0.006 MLips
    %    true.

    /* Scryer Prolog 0.9.4-547 */

    % ?- member(N,[5,10,15]), time(test3(N)), fail; true.
    %    % CPU time: 0.002s, 7_120 inferences
    %    % CPU time: 0.053s, 7_135 inferences
    %    % CPU time: 1.657s, 7_150 inferences
    %    true.

    The test case:

    hydra(0, n) :- !.
    hydra(N, s(X,X)) :-
        M is N-1,
        hydra(M, X).

    hydra2(0, _) :- !.
    hydra2(N, s(X,X)) :-
        M is N-1,
        hydra2(M, X).

    test3(N) :-
        hydra(N,X), hydra2(1,Y),
        between(1,1000,_), unify_with_occurs_check(X, Y), fail; true.

    Mild Shock schrieb:
    Woa! This nonsense really made my day:

    https://github.com/mthom/scryer-prolog/discussions/3004

    It starts with, where somebody "tried" a declarative DCG
    using constraint logic programming:

    number_tail(0, 0) --> [].
    number_tail(Number, DigitsCount) -->
       ("," | ""),
       digit(Digit),
       number_tail(Digits, RestDigitsCount),
       {
         DigitsCount #= RestDigitsCount + 1,
         Number #= Digit * 10 ^ RestDigitsCount + Digits
       }.

    He then noticed that its not deterministic. And since
    it is not deterministic, clause ordering changes the
    result when onced via once/1.

    LoL


    --- Synchronet 3.21f-Linux NewsLink 1.2