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
“~t has the same or one more
space than all the preceding ones”
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:--- Synchronet 3.21f-Linux NewsLink 1.2
https://prolog-lang.org/ImprovementsForum/0110-format.html
Bye
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
See also:
https://prolog-lang.org/ImprovementsForum/0110-format.html
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
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
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
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
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,116 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 86:55:51 |
| Calls: | 14,305 |
| Files: | 186,338 |
| D/L today: |
1,021 files (322M bytes) |
| Messages: | 2,525,511 |