Things that are not in the ISO core standard are more--- Synchronet 3.20a-Linux NewsLink 1.114
likely to behave differently across Prolog systems?
GNU Prolog behaves already differently to SWI-Prolog in
numbervars/3. I find this discrepancy:
/* GNU Prolog 1.5.0 */
?- X = f(A,X), numbervars(X, 0, _), write_canonical(A), nl.
_24
cannot display cyclic term for X
/* SWI-Prolog 9.1.16 */
?- X = f(A,X), numbervars(X, 0, _), write_canonical(A), nl.
'$VAR'(0)
X = f(A, X),
A = A.
LoL
So what goodies are there in library(compat) as well?--- Synchronet 3.20a-Linux NewsLink 1.114
Check this out:
/* SWI-Prolog 9.1.16 */
?- numlist(1,100000,A), numlist(1,100000,B),
time((between(1,1000,_), subsumes((f(_),X,X),(_,A,B)),
fail; true)), fail.
% 2,999 inferences, 2.375 CPU in 2.498 seconds (95% CPU, 1263 Lips)
false.
/* Dogelog Player 1.1.3 for Java (new!) */
?- numlist(1,100000,A), numlist(1,100000,B),
time((between(1,1000,_), subsumes((f(_),X,X),(_,A,B)),
fail; true)), fail.
% Zeit 2 ms, GC 0 ms, Lips 1550000, Uhr 18.10.2023 17:40
fail.
Dogelog Player for Java came out a few days ago. To get
subsumes/2 you have to use ensure_loaded(library(compat)).
I am using Richard O’Keefes algorithm from 1984 for subsumes/2.
Mild Shock schrieb am Mittwoch, 18. Oktober 2023 um 14:59:26 UTC+2:
Things that are not in the ISO core standard are more
likely to behave differently across Prolog systems?
GNU Prolog behaves already differently to SWI-Prolog in
numbervars/3. I find this discrepancy:
/* GNU Prolog 1.5.0 */
?- X = f(A,X), numbervars(X, 0, _), write_canonical(A), nl.
_24
cannot display cyclic term for X
/* SWI-Prolog 9.1.16 */
?- X = f(A,X), numbervars(X, 0, _), write_canonical(A), nl.
'$VAR'(0)
X = f(A, X),
A = A.
LoL
I am not extremly convinced by Richard O'Keefes approach--- Synchronet 3.20a-Linux NewsLink 1.114
for subsumes/2. Especially how I have implemented it in
Dogelog Player, avoiding term_variables/2 all togtether!
Possibly I can produce some drastic test cases where it
doesn't run very well. On the other hand Jan W. is conceptually
promoting this bootstrapping of subsumes/2:
subsumes(General, Specific) :-
term_variables(Specific, SVars),
General = Specific,
term_variables(SVars, SVars).
The above cannot fast fail like Richard O'Keefes approach
can do. The further boostrapping is identical:
subsumes_term(General, Specific) :-
\+ \+ subsumes(General, Specific).
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 910 |
Nodes: | 10 (0 / 10) |
Uptime: | 225:26:21 |
Calls: | 12,117 |
Calls today: | 1 |
Files: | 186,505 |
Messages: | 2,226,951 |