• 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
    %-a-a-a true.

    /* Scryer Prolog 0.9.4-547 */

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

    The test case:

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

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

    test3(N) :-
    -a-a hydra(N,X), hydra2(1,Y),
    -a-a 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) -->
    -a-a ("," | ""),
    -a-a digit(Digit),
    -a-a number_tail(Digits, RestDigitsCount),
    -a-a {
    -a-a-a-a DigitsCount #= RestDigitsCount + 1,
    -a-a-a-a Number #= Digit * 10 ^ RestDigitsCount + Digits
    -a-a }.

    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:

    rCL~t has the same or one more
    space than all the preceding onesrCY

    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", []),
    -a-a 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 ************************* *-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 123-a-a-a-a-a-a-a-a 45-a-a-a-a-a-a-a-a 678-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a *

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

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

    Expected output would be, yes we can do it!

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


    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:

    rCL~t has the same or one more
    space than all the preceding onesrCY

    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-a b-a c-a-a d-a-a e
    true.

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

    /* Dogelog Player 2.2.2 */
    ?- format('~w~t~w~t~w~t~w~t~w~15|', [a,b,c,d,e]), nl.
    a-a b-a-a c-a d-a-a 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-a b-a c-a d-a e
    -a-a 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", []),
    -a-a-a 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 *************************
    *-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 123-a-a-a-a-a-a-a-a 45-a-a-a-a-a-a-a-a 678-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a *

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

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

    Expected output would be, yes we can do it!

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


    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 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 (XVMrao) 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 (XVMrao) 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 (XVMrao) 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 (XVMrao) 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", []),
    -a-a 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 ************************* *-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a 123-a-a-a-a-a-a-a-a 45-a-a-a-a-a-a-a-a 678-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a-a *

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

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

    Expected output would be, yes we can do it!

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


    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
    %-a-a-a true.

    /* Scryer Prolog 0.9.4-547 */

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

    The test case:

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

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

    test3(N) :-
    -a-a-a hydra(N,X), hydra2(1,Y),
    -a-a-a 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) -->
    -a-a ("," | ""),
    -a-a digit(Digit),
    -a-a number_tail(Digits, RestDigitsCount),
    -a-a {
    -a-a-a-a DigitsCount #= RestDigitsCount + 1,
    -a-a-a-a Number #= Digit * 10 ^ RestDigitsCount + Digits
    -a-a }.

    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