Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.prolog > #14757
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Newsgroups | comp.lang.prolog |
| Subject | Does Scryer Prolog have all tricks up its sleeves? [Occurs Check] (Was: Scryer Prolog totally clueless how DCGs work) |
| Date | 2025-08-04 19:47 +0200 |
| Message-ID | <106qrno$3cht3$1@solani.org> (permalink) |
| References | <104ld1i$1vsct$1@solani.org> |
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
Back to comp.lang.prolog | Previous | Next — Previous in thread | Find similar
Scryer Prolog totally clueless how DCGs work Mild Shock <janburse@fastmail.fm> - 2025-07-09 11:33 +0200
Lets see what the "experts" say (Was: Scryer Prolog totally clueless how DCGs work) Mild Shock <janburse@fastmail.fm> - 2025-07-09 11:36 +0200
Payed Ass-Lickers all around (Was: Lets see what the "experts" say) Mild Shock <janburse@fastmail.fm> - 2025-07-09 11:38 +0200
Its all about the money, not about quality (Was: Payed Ass-Lickers all around) Mild Shock <janburse@fastmail.fm> - 2025-07-09 11:42 +0200
A case of dumbification by committee membership? (Was: Its all about the money, not about quality) Mild Shock <janburse@fastmail.fm> - 2025-07-09 20:01 +0200
The stack overflow user by the name false (Was: Lets see what the "experts" say) Mild Shock <janburse@fastmail.fm> - 2025-07-15 11:50 +0200
The choice is a little arbitrary from one angle (Re: The stack overflow user by the name false) Mild Shock <janburse@fastmail.fm> - 2025-07-15 11:59 +0200
Does Scryer Prolog have all tricks up its sleeves? [Occurs Check] (Was: Scryer Prolog totally clueless how DCGs work) Mild Shock <janburse@fastmail.fm> - 2025-08-04 19:47 +0200
csiph-web