In case you are interested in imperfections
of the ISO core standard. Maybe this can be
read off from Dogelog, imperfections
that even affect a lean language. You might
read off imperfections from which predicates
got implemented and are not in the ISO
core standard. Since I have only implemented
the absolute minimum right now, this might
be an indicative what was overlooked
in the ISO core standard. But there are only
like 3-5 predicates which are not from the ISO
core standard, but found in Dogelog:
- consult/1 (from everywhere)
- listing/1 (from everywhere)
- '$MARK'/1 and friends (from BIM ProLog, Bruynooghe)
- change_arg/3 (from BinProlog, Tarau)
- What else?
'$MARK'/1 and friends allow a more reflective
implementation of the Prolog system. One can
write an ISO core standard conforming
call/1 in Prolog itself. change_arg/3 is
used to inplement findall/3. But '$MARK'/1 and
change_arg/3 are highly implementation specific,
so that the ISO core standard doesn't have
such things is somehow justified.
Mostowski Collapse schrieb:
Dogelog is lean, currently it doesn't have (@<)/2,
sort/2, thread_create/2, etc..
For more information:
"The Dogelog Runtime is a small and fast ISO core
standard Prolog system that runs in a browser or on
node.js. The Dogelog Runtime supports old browsers
with common JavaScript and new browsers with
module JavaScript."
https://github.com/jburse/dogelog-moon
Julio Di Egidio schrieb:
IMO, Prolog is an amazing idea with amazing potential,but should be refocused and rewritten from scratch: as a low-level "logical" language with the leanest possible spec
and VM, and the smallest possible runtime, so that it
easily runs everywhere: expert systems and stuff like
that... Prolog 2.0, maybe.
Unexpectedly, we could bring change_arg/3 from
Dogelog Player to formerly Jekejeke Prolog.
We have found change_arg/3 quite useful for the
realization of built-ins such as findall/3, etc.. in the
Dogelog Player. Bringing it to formerly Jekejeke Prolog
opens up new roads of compatibility and portability
between the two Prolog systems. We could already
explore the compliance test suite.
See also:
change_arg/2 for a two Pointer Prolog System https://twitter.com/dogelogch/status/1514530478371622914
change_arg/2 for a two Pointer Prolog System https://www.facebook.com/groups/dogelog
Mostowski Collapse schrieb am Donnerstag, 8. Juli 2021 um 17:45:26 UTC+2:
In case you are interested in imperfections
of the ISO core standard. Maybe this can be
read off from Dogelog, imperfections
that even affect a lean language. You might
read off imperfections from which predicates
got implemented and are not in the ISO
core standard. Since I have only implemented
the absolute minimum right now, this might
be an indicative what was overlooked
in the ISO core standard. But there are only
like 3-5 predicates which are not from the ISO
core standard, but found in Dogelog:
- consult/1 (from everywhere)
- listing/1 (from everywhere)
- '$MARK'/1 and friends (from BIM ProLog, Bruynooghe)
- change_arg/3 (from BinProlog, Tarau)
- What else?
'$MARK'/1 and friends allow a more reflective
implementation of the Prolog system. One can
write an ISO core standard conforming
call/1 in Prolog itself. change_arg/3 is
used to inplement findall/3. But '$MARK'/1 and
change_arg/3 are highly implementation specific,
so that the ISO core standard doesn't have
such things is somehow justified.
Mostowski Collapse schrieb:
Dogelog is lean, currently it doesn't have (@<)/2,
sort/2, thread_create/2, etc..
For more information:
"The Dogelog Runtime is a small and fast ISO core
standard Prolog system that runs in a browser or on
node.js. The Dogelog Runtime supports old browsers
with common JavaScript and new browsers with
module JavaScript."
https://github.com/jburse/dogelog-moon
Julio Di Egidio schrieb:
IMO, Prolog is an amazing idea with amazing potential,but should be refocused and rewritten from scratch: as a low-level "logical" language with the leanest possible spec
and VM, and the smallest possible runtime, so that it
easily runs everywhere: expert systems and stuff like
that... Prolog 2.0, maybe.
About change_arg/3 and the call_nth/2 use case. Its also available in
SICStus Prolog, by another predicate name I guess!!! Of course it needs intimate knowledge how compounds are allocated, deallocated or otherwise manipulated by the Prolog system. The use case of call_nth/2 is
quite tame, since we do only update with an atomic, in particular
with an integer, and not with a compound value of some sort,
ground or not ground. But you gain quite some speed:
You get near metal speed!!!
count the number of calls of a clause https://stackoverflow.com/a/11400256/17524790
In formerly Jekejeke Prolog the trick with the extra variable
doesn't work, i.e. State=count(0,_), but functor(State, count, 1)
works, and in Dogelog Player, current version State=count(0)
can be used. I don't know what would work in Scryer Prolog.
Also there are rumors that there are Coq and Isabelle/HOL
libraries that allow reasoning about the construct, since it mimics
aspects of RAM machines, which do have formalizations.
Oops, yes my bad. It could be that SICStus Prolog and ECLiPSe Prolog do
not have some change_arg/3 equivalent. Was also making an experiment with:
call_nth2(Goal_0, C) :-
State = v(0),
Goal_0,
arg(1, State, C1),
C2 is C1+1,
nb_linkarg(1, State, C2),
% setarg(1, State, C2, false), % for GNU Prolog
C = C2.
And then I got:
/* SWI-Prolog */
?- time((between(1,1000000,_),
call_nth2(call_nth2((X=a;X=b),N), M), fail; true)).
% 10,000,003 inferences, 0.859 CPU in 0.847 seconds
(101% CPU, 11636367 Lips)
true.
/* GNU Prolog */
?- ((between(1,1000000,_),
call_nth2(call_nth2((X=a;X=b),N), M), fail; true)).
(1578 ms) yes
Was I allowed to use nb_linkarg/3? If this is allowed, then SWI-Prolog
ranks top in speed.
Mostowski Collapse schrieb am Donnerstag, 21. April 2022 um 12:26:55 UTC+2:
If you don't think about introducing change_arg/3 in your Prolog system head start first, and start implementing call_nth/2 and all other stuff instead
first, you are doing something wrong.
Also that change_arg/3 isn't widely available is not correct, since recently I have it in formerly Jekejeke Prolog. So the list is bigger:
- SWI-Prolog (corresponds to nb_linkarg/3, right?)
- YAP (corresponds to nb_linkarg/3, right?)
- GNU Prolog (possibly setarg/4 with 4-th argument false)
- SICStus Prolog (didn't check yet which one is change_arg/3 exactly)
- ECLiPSe Prolog (didn't check yet which one is change_arg/3 exactly)
- Formerly Jekejeke Prolog (by its name)
- Dogelog Player (by its name)
- BinProlog from Paul Tarau (by its name)
- ... What else?
If you don't think about introducing change_arg/3 in your Prolog system
head start first, and start implementing call_nth/2 and all other stuff instead
first, you are doing something wrong.
Also that change_arg/3 isn't widely available is not correct, since
recently I have it in formerly Jekejeke Prolog. So the list is bigger:
- SWI-Prolog (corresponds to nb_linkarg/3, right?)
- YAP (corresponds to nb_linkarg/3, right?)
- GNU Prolog (possibly setarg/4 with 4-th argument false)
- SICStus Prolog (didn't check yet which one is change_arg/3 exactly)
- ECLiPSe Prolog (didn't check yet which one is change_arg/3 exactly)
- Formerly Jekejeke Prolog (by its name)
- Dogelog Player (by its name)
- BinProlog from Paul Tarau (by its name)
- ... What else?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 491 |
Nodes: | 16 (2 / 14) |
Uptime: | 147:05:10 |
Calls: | 9,694 |
Calls today: | 4 |
Files: | 13,732 |
Messages: | 6,178,671 |