So the LLVM gurus use word such as "intent" and "declarative"
with their own connotation:
2.3 A-LLVM
A-LLVM refers to the ideas and programming approach as
well as the techniques, tools, software collection, and resulting
system that use allexes. These technologies make it possible
to easily analyze and transform software in the context it is
executed. The ideas central to A-LLVM are discussed above in
“Declarative Programming” (Section 2.1.3). Below focuses on
the implementation.
Aligning intent and behavior in software systems:
how programs communicate & their distribution and organization https://www.ideals.illinois.edu/handle/2142/107994
But since LLVM is used for mostly imperative languages, this is
somehow proof that this community reads something else into
“intent” and “declarative”. Go figure what they mean, like read
the abstract. I am not saying it cannot be used for logic programming.
Ha Ha, some old gloom and doom:
Why The Future Doesn't Need Us - Bill Joy, April 2000 =====================================================
Joy argues that developing technologies provide a much
greater danger to humanity than any technology before
has ever presented. In particular, he focuses on
engineering, nanotechnology and robotics.
He argues that 20th-century technologies of destruction
such as the nuclear bomb were limited to large governments,
due to the complexity and cost of such devices, as well
as the difficulty in acquiring the required materials.
He uses the novel The White Plague as a potential nightmare
scenario, in which a mad scientist creates a virus capable
of wiping out humanity. [...] Joy expresses concerns that
eventually the rich will be the only ones that have the
power to control the future robots that will be built and
that these people could also decide to take life into
their own hands and control how humans continue to
populate and reproduce.
https://en.wikipedia.org/wiki/Why_The_Future_Doesn't_Need_Us
Sounds familar? I only find a 2008 aftermath:
In the 15th Anniversary issue of Wired in 2008,
Lucas Graves's article reported that the genetics,
nanotechnology, and robotics technologies have not
reached the level that would make Bill Joy's
scenario come true.
Whats the 2021 aftermath?
An interesting idea motivated by Yield Prolog, instead of
supporting bigint, fallback to float. So we wouldn't have this error:
/* Tau Prolog */
?- factorial(29,X).
uncaught exception: error(evaluation_error(int_overflow),is/2)
SWI-Prolog claims to do that when it is compiled without GMP.
I don’t know whether this is consistently done in some Prolog
system. Assume you fallback to float for bigint, what should
be the result of the mod operator? I get in Yield Prolog:
X is 333333333333333.3 mod 1000000.
X = 333333;
And in SWI-Prolog, not sure what it does without GMP:
?- X is 333333333333333.3 mod 1000000.
ERROR: Type error: `integer' expected, found `333333333333333.3' (a float)
And natively what the JavaScript (%)/2 operator can do, its rather
(rem)/2 and not (mod)/2, but YieldProlog didn’t accept (rem)/2, so
still showing (mod)/2:
?- X is 333333333333333.3 mod 1000000.
X = 333333.3125.
Ok, sounds good:
Built by a Team of Veterans
Skip is a general-purpose programming language
Copyright © 2022 Facebook Inc.
Ok lets try it, the web GUI does:
POST http://skiplang.com/playground/skip_to_js
Request:
fun main(): void {
print_string("Hello Skip!")
}
Response (after quite some time):
38349 lines of JS
LMAO!
Figured out how to run SWIPL WASM locally, without
the need for some webserver. Just copy the dist content
and the example index. Could do some benchmarking,
using the Pelletier Testcases:
Test SWI 7.1.34 Doge 0.9.8
leanSeq 532 ms 844 ms 159%
leanTap 241 ms 458 ms 190%
leanSeq= 105 ms 165 ms 157%
leanTap= 1961 ms 3910 ms 199%
Was also comparing file sizes:
SWI 7.1.34 Doge 0.9.8
swipl-web.data 2210 KB
swipl-web.js 180 KB
swipl-web.wasm 1263 KB
dogelog.js 261 KB
Total 3653 KB 261 KB
But didn’t try yet all Prolog optimization tricks for Doge.
Looks like they could resolve it (*). So SWI-Prolog finally
enters the WASM domain before Scryer-Prolog, after
SWI-Prolog was dormant for some years?
There were always rumors, Scryer-Prolog because it
uses Rust, will also do WASM. But recently Scryer-Prolog
can even not do between/3 (**) anymore…
Congratulations! Now I expect soon seeing a SWI-Prolog
engine running on the client, and doing some legal reasoning
over an XML document (***) ?
Could give new momentum to good ole Prolog…
(*)
https://github.com/SWI-Prolog/swipl-devel/issues/942
(**)
https://github.com/mthom/scryer-prolog/issues/1269
(***)
https://www.youtube.com/watch?v=WBmwiHY4Q-Q
Edit 23.02.2022:
Will soon do some testing with Version 8.x, of course I
want to beat SWI-Prolog performance wise in the long run?
You dont mind being sporty?
Mostowski Collapse schrieb am Sonntag, 20. Februar 2022 um 18:51:12 UTC+1:
Figured out how to run SWIPL WASM locally, without
the need for some webserver. Just copy the dist content
and the example index. Could do some benchmarking,
using the Pelletier Testcases:
Test SWI 7.1.34 Doge 0.9.8
leanSeq 532 ms 844 ms 159%
leanTap 241 ms 458 ms 190%
leanSeq= 105 ms 165 ms 157%
leanTap= 1961 ms 3910 ms 199%
Was also comparing file sizes:
SWI 7.1.34 Doge 0.9.8
swipl-web.data 2210 KB
swipl-web.js 180 KB
swipl-web.wasm 1263 KB
dogelog.js 261 KB
Total 3653 KB 261 KB
But didn’t try yet all Prolog optimization tricks for Doge.
Whats the reason for the between/3 blooper in Scryer-Prolog.
Failure or missing Prolog garbage collection. Relying
solely on Rust smart pointers. And why a segfault?
At least I solved this problem ab-initio in Dogelog. A
recent addition was between/3 in the sense of a Prologue
to Prolog. But I didn't implement it natively, only some
predefined Prolog code. It runs and runs and runs:
?- time((between(1,15000000,I),fail;true)).
% Wall 30265 ms, gc 424 ms, 1486918 lips
true.
Was using the auto-yielding variant of Dogelog player
link below, so currently lower LIPS, since the above
test is a little long runner: http://www.xlog.ch/izytab/doclet/docs/18_live/10_reference/example03/package.html
Mostowski Collapse schrieb am Mittwoch, 23. Februar 2022 um 15:03:33 UTC+1:
Looks like they could resolve it (*). So SWI-Prolog finally
enters the WASM domain before Scryer-Prolog, after
SWI-Prolog was dormant for some years?
There were always rumors, Scryer-Prolog because it
uses Rust, will also do WASM. But recently Scryer-Prolog
can even not do between/3 (**) anymore…
Congratulations! Now I expect soon seeing a SWI-Prolog
engine running on the client, and doing some legal reasoning
over an XML document (***) ?
Could give new momentum to good ole Prolog…
(*)
https://github.com/SWI-Prolog/swipl-devel/issues/942
(**)
https://github.com/mthom/scryer-prolog/issues/1269
(***)
https://www.youtube.com/watch?v=WBmwiHY4Q-Q
Edit 23.02.2022:
Will soon do some testing with Version 8.x, of course I
want to beat SWI-Prolog performance wise in the long run?
You dont mind being sporty?
Mostowski Collapse schrieb am Sonntag, 20. Februar 2022 um 18:51:12 UTC+1:
Figured out how to run SWIPL WASM locally, without
the need for some webserver. Just copy the dist content
and the example index. Could do some benchmarking,
using the Pelletier Testcases:
Test SWI 7.1.34 Doge 0.9.8
leanSeq 532 ms 844 ms 159%
leanTap 241 ms 458 ms 190%
leanSeq= 105 ms 165 ms 157%
leanTap= 1961 ms 3910 ms 199%
Was also comparing file sizes:
SWI 7.1.34 Doge 0.9.8
swipl-web.data 2210 KB
swipl-web.js 180 KB
swipl-web.wasm 1263 KB
dogelog.js 261 KB
Total 3653 KB 261 KB
But didn’t try yet all Prolog optimization tricks for Doge.
I currently do hold the believe that Scryer Prolog lost it.
They should have stopped the project when they saw that
Scryer Prolog didn't perform. But they are kind of
megalomaniac, which is seen in their manifesto:
"Scryer Prolog aims to become to ISO Prolog what GHC is to Haskell" https://github.com/mthom/scryer-prolog
Now they feel the pain, and they started a branch rebis-dev,
with a curious agenda. But I don't see anything on the
agenda that would convince me that they will make it:
- Replacing choice points pivoting on inlined semi-deterministic
predicates (atom, var, etc) with if/else ladders
/* Doesn't make the slow duck run faster in pure Prolog */
- Inlining all built-ins and system call instructions
/* Doesn't make the slow duck run faster in pure Prolog */
- Greatly reducing the number of instructions used to compile disjunctives /* Doesn't make the slow duck run faster in pure Prolog */
- Storing short atoms to heap cells without writing them to the atom table /* Doesn't make the slow duck run faster in pure Prolog */
Ha Ha
Mostowski Collapse schrieb am Mittwoch, 23. Februar 2022 um 15:14:11 UTC+1:
Whats the reason for the between/3 blooper in Scryer-Prolog.
Failure or missing Prolog garbage collection. Relying
solely on Rust smart pointers. And why a segfault?
At least I solved this problem ab-initio in Dogelog. A
recent addition was between/3 in the sense of a Prologue
to Prolog. But I didn't implement it natively, only some
predefined Prolog code. It runs and runs and runs:
?- time((between(1,15000000,I),fail;true)).
% Wall 30265 ms, gc 424 ms, 1486918 lips
true.
Was using the auto-yielding variant of Dogelog player
link below, so currently lower LIPS, since the above
test is a little long runner: http://www.xlog.ch/izytab/doclet/docs/18_live/10_reference/example03/package.html
Mostowski Collapse schrieb am Mittwoch, 23. Februar 2022 um 15:03:33 UTC+1:
Looks like they could resolve it (*). So SWI-Prolog finally
enters the WASM domain before Scryer-Prolog, after
SWI-Prolog was dormant for some years?
There were always rumors, Scryer-Prolog because it
uses Rust, will also do WASM. But recently Scryer-Prolog
can even not do between/3 (**) anymore…
Congratulations! Now I expect soon seeing a SWI-Prolog
engine running on the client, and doing some legal reasoning
over an XML document (***) ?
Could give new momentum to good ole Prolog…
(*)
https://github.com/SWI-Prolog/swipl-devel/issues/942
(**)
https://github.com/mthom/scryer-prolog/issues/1269
(***)
https://www.youtube.com/watch?v=WBmwiHY4Q-Q
Edit 23.02.2022:
Will soon do some testing with Version 8.x, of course I
want to beat SWI-Prolog performance wise in the long run?
You dont mind being sporty?
Mostowski Collapse schrieb am Sonntag, 20. Februar 2022 um 18:51:12 UTC+1:
Figured out how to run SWIPL WASM locally, without
the need for some webserver. Just copy the dist content
and the example index. Could do some benchmarking,
using the Pelletier Testcases:
Test SWI 7.1.34 Doge 0.9.8
leanSeq 532 ms 844 ms 159%
leanTap 241 ms 458 ms 190%
leanSeq= 105 ms 165 ms 157%
leanTap= 1961 ms 3910 ms 199%
Was also comparing file sizes:
SWI 7.1.34 Doge 0.9.8
swipl-web.data 2210 KB
swipl-web.js 180 KB
swipl-web.wasm 1263 KB
dogelog.js 261 KB
Total 3653 KB 261 KB
But didn’t try yet all Prolog optimization tricks for Doge.
In my opinion the slowness has possibly todo with
the Rust platform and the smart pointers which are
not that fast like different approaches to garbage collected
memory and then possibly with some baroque programming
style. But I don't completely understand how this programming
style happens and whether it really imposes a penality, but
the Scryer Prolog source code gives me a strange feeling...
Mostowski Collapse schrieb am Mittwoch, 23. Februar 2022 um 15:24:49 UTC+1:
I currently do hold the believe that Scryer Prolog lost it.
They should have stopped the project when they saw that
Scryer Prolog didn't perform. But they are kind of
megalomaniac, which is seen in their manifesto:
"Scryer Prolog aims to become to ISO Prolog what GHC is to Haskell" https://github.com/mthom/scryer-prolog
Now they feel the pain, and they started a branch rebis-dev,
with a curious agenda. But I don't see anything on the
agenda that would convince me that they will make it:
- Replacing choice points pivoting on inlined semi-deterministic predicates (atom, var, etc) with if/else ladders
/* Doesn't make the slow duck run faster in pure Prolog */
- Inlining all built-ins and system call instructions
/* Doesn't make the slow duck run faster in pure Prolog */
- Greatly reducing the number of instructions used to compile disjunctives /* Doesn't make the slow duck run faster in pure Prolog */
- Storing short atoms to heap cells without writing them to the atom table /* Doesn't make the slow duck run faster in pure Prolog */
Ha Ha
Mostowski Collapse schrieb am Mittwoch, 23. Februar 2022 um 15:14:11 UTC+1:
Whats the reason for the between/3 blooper in Scryer-Prolog.
Failure or missing Prolog garbage collection. Relying
solely on Rust smart pointers. And why a segfault?
At least I solved this problem ab-initio in Dogelog. A
recent addition was between/3 in the sense of a Prologue
to Prolog. But I didn't implement it natively, only some
predefined Prolog code. It runs and runs and runs:
?- time((between(1,15000000,I),fail;true)).
% Wall 30265 ms, gc 424 ms, 1486918 lips
true.
Was using the auto-yielding variant of Dogelog player
link below, so currently lower LIPS, since the above
test is a little long runner: http://www.xlog.ch/izytab/doclet/docs/18_live/10_reference/example03/package.html
Mostowski Collapse schrieb am Mittwoch, 23. Februar 2022 um 15:03:33 UTC+1:
Looks like they could resolve it (*). So SWI-Prolog finally
enters the WASM domain before Scryer-Prolog, after
SWI-Prolog was dormant for some years?
There were always rumors, Scryer-Prolog because it
uses Rust, will also do WASM. But recently Scryer-Prolog
can even not do between/3 (**) anymore…
Congratulations! Now I expect soon seeing a SWI-Prolog
engine running on the client, and doing some legal reasoning
over an XML document (***) ?
Could give new momentum to good ole Prolog…
(*)
https://github.com/SWI-Prolog/swipl-devel/issues/942
(**)
https://github.com/mthom/scryer-prolog/issues/1269
(***)
https://www.youtube.com/watch?v=WBmwiHY4Q-Q
Edit 23.02.2022:
Will soon do some testing with Version 8.x, of course I
want to beat SWI-Prolog performance wise in the long run?
You dont mind being sporty?
Mostowski Collapse schrieb am Sonntag, 20. Februar 2022 um 18:51:12 UTC+1:
Figured out how to run SWIPL WASM locally, without
the need for some webserver. Just copy the dist content
and the example index. Could do some benchmarking,
using the Pelletier Testcases:
Test SWI 7.1.34 Doge 0.9.8
leanSeq 532 ms 844 ms 159%
leanTap 241 ms 458 ms 190%
leanSeq= 105 ms 165 ms 157%
leanTap= 1961 ms 3910 ms 199%
Was also comparing file sizes:
SWI 7.1.34 Doge 0.9.8
swipl-web.data 2210 KB
swipl-web.js 180 KB
swipl-web.wasm 1263 KB
dogelog.js 261 KB
Total 3653 KB 261 KB
But didn’t try yet all Prolog optimization tricks for Doge.
I currently do hold the believe that Scryer Prolog lost it.
They should have stopped the project when they saw that
Scryer Prolog didn't perform. But they are kind of
By slow, I mean Scryer Prolog is ridiculous slow. It is
really really slow, up to the point that it isn't useable.
I get on my AMD Ryzen machine, using WSL:
$ target/release/scryer-prolog
?- use_module(library(between)).
true.
?- time((between(1,100000,_), fail; true)).
% CPU time: 8.189s
true.
Now try the same in Dogelog player in Windows/Chrome
on my same AMD Ryzen machine:
?- time((between(1,100000,_), fail; true)).
% Wall 81 ms, gc 0 ms, 3704654 lips
true.
http://www.xlog.ch/izytab/doclet/docs/18_live/10_reference/example01/package.html
Thats a factor 100x slower for some between/3.
Scryer Prolog is 100x times slower. And I don't
have a native between/3 implementation,
its a 100% Prolog implementation.
Mostowski Collapse schrieb am Mittwoch, 23. Februar 2022 um 15:24:49 UTC+1:
I currently do hold the believe that Scryer Prolog lost it.
They should have stopped the project when they saw that
Scryer Prolog didn't perform. But they are kind of
Maybe there is something wrong with their library(between)?
May latest take is quite simple, it uses also a little Gertjan
van Noord Trick, in that it pays attention to not leave a choice
point for the last answer:
/**
* between(L, H, X):
* The predicate succeeds for every integer X between L and H.
* Currently only implemented for mode between(+, +, -).
*/
% between(+Integer, +Integer, -Integer)
between(Lo, Hi, X) :-
sys_check_integer(Lo),
sys_check_integer(Hi),
Lo =< Hi,
sys_between(Lo, Hi, X).
% sys_between(+Integer, +Integer, -Integer)
sys_between(Lo, Lo, Lo) :- !.
sys_between(Lo, _, Lo).
sys_between(Lo, Hi, X) :- Lo2 is Lo+1, sys_between(Lo2, Hi, X).
Mostowski Collapse schrieb am Mittwoch, 23. Februar 2022 um 17:51:37 UTC+1:
By slow, I mean Scryer Prolog is ridiculous slow. It is
really really slow, up to the point that it isn't useable.
I get on my AMD Ryzen machine, using WSL:
$ target/release/scryer-prolog
?- use_module(library(between)).
true.
?- time((between(1,100000,_), fail; true)).
% CPU time: 8.189s
true.
Now try the same in Dogelog player in Windows/Chrome
on my same AMD Ryzen machine:
?- time((between(1,100000,_), fail; true)).
% Wall 81 ms, gc 0 ms, 3704654 lips
true.
http://www.xlog.ch/izytab/doclet/docs/18_live/10_reference/example01/package.html
Thats a factor 100x slower for some between/3.
Scryer Prolog is 100x times slower. And I don't
have a native between/3 implementation,
its a 100% Prolog implementation.
Mostowski Collapse schrieb am Mittwoch, 23. Februar 2022 um 15:24:49 UTC+1:
I currently do hold the believe that Scryer Prolog lost it.
They should have stopped the project when they saw that
Scryer Prolog didn't perform. But they are kind of
That SWI-Prolog is closer to the Albufeira instruction set
is also seen in that it has "pop" instructions. I ditched them.
Mostowski Collapse schrieb am Mittwoch, 23. Februar 2022 um 18:12:35 UTC+1:
The first two clauses of sys_between/3 shouldn't
allocate anything, thanks to the new Op-Code 5,
Named Para. Dogelog player has only 6 Op-Codes:
case 0: // singleton
case 1: // first_var(N)
case 2: // var(N)
case 3: // functor(F,A)
case 4: // atomic(C)
case 5: // para(N)
The only brake in Dogelog player is clause Nr. 3, which
needs to allocate stuff to perform the evaluation and
does also allocate stuff to perform the tail recursion,
SWI-Prolog is better off here, since it implements the
Albufeira instruction set more closely to the original
paper than we do. Also SWI-Prolog has a register window
The first two clauses of sys_between/3 shouldn't
allocate anything, thanks to the new Op-Code 5,
Named Para. Dogelog player has only 6 Op-Codes:
case 0: // singleton
case 1: // first_var(N)
case 2: // var(N)
case 3: // functor(F,A)
case 4: // atomic(C)
case 5: // para(N)
The only brake in Dogelog player is clause Nr. 3, which
needs to allocate stuff to perform the evaluation and
does also allocate stuff to perform the tail recursion,
SWI-Prolog is better off here, since it implements the
Albufeira instruction set more closely to the original
paper than we do. Also SWI-Prolog has a register window
Ok, could build it -b rebis-dev, I now get, using
the same Prolog code for both systems:
/* Scryer Prolog, WSL */
?- time((between(1,1000000,_), fail; true)).
% CPU time: 0.282s
true.
/* Dogelog Player, Windows/Chrome */
?- time((between(1,1000000,_), fail; true)).
% Wall 822 ms, gc 8 ms, 3649728 lips
true.
Is there already a way to run the example
with node.js or in a browser?
Looks like they could resolve it (*). So SWI-Prolog finally
enters the WASM domain before Scryer-Prolog, after
SWI-Prolog was dormant for some years?
This is nonsense, or only refers to the operator itself and not its context:
there’s no syntactic difference between operators and operands
The standard syntactic difference is, for those f found in the operator table:
(f) operand
f operator
The grammar rule (f) for operand is very easy to write down, and it went explicitly into the ISO core standard. But already Quintus must have
had more rules on the operand side. That Quintus had more operand
rules is evidence from chat80 source code, I find:
:-mode decomp(+,-,-).
https://www.swi-prolog.org/pack/file_details/chat80/prolog/chat80/talkr.pl?show=src
Both + and - are prefix operators. But they loose their operator-ness and become
operands. These other syntactic Quintus grammar rules for operands are more difficult to grasp and formulate than the simple (f) that went into the ISO core
standard. But its not a hopeless case. An amendment for the ISO core standard wouldn’t be that difficult and is rather straight forward. It would
be simply to only consider prefix f and say:
f $STOPPER operand
f operator
Where $STOPPER ∈ {’,’, ‘|’, ‘)’, ‘}’, ‘]’, ‘.’}. This also covers the old (f).
Infix and postfix do not need some special treatment.
The computation of such stoppers is a standard technique in grammar compilation. The above is motivated that we would go into a grammar production ‘f term’ where f is prefix, only when there is really a term.
One can easily check the ISO core standard grammar that there is no ‘term’ that starts with a $STOPPER when $STOPPER ∈ {’,’, ‘|’, ‘)’, ‘}’, ‘]’, ‘.’}.
So the grammar production for prefix basically changes from ‘f term’ into
‘f [ term ]’ making the use of term and building a prefix compound optional,
requiring that there is really a term that follows a prefix operator. The decision
with $STOPPER is highly efficient and doesn’t need some extra look ahead Mostowski Collapse schrieb am Donnerstag, 24. Februar 2022 um 17:04:38 UTC+1:
This is nonsense, or only refers to the operator itself and not its context:
there’s no syntactic difference between operators and operands
The standard syntactic difference is, for those f found in the operator table:
(f) operand
f operator
The grammar rule (f) for operand is very easy to write down, and it went explicitly into the ISO core standard. But already Quintus must have
had more rules on the operand side. That Quintus had more operand
rules is evidence from chat80 source code, I find:
:-mode decomp(+,-,-).
https://www.swi-prolog.org/pack/file_details/chat80/prolog/chat80/talkr.pl?show=src
Both + and - are prefix operators. But they loose their operator-ness and become
operands. These other syntactic Quintus grammar rules for operands are more
difficult to grasp and formulate than the simple (f) that went into the ISO core
standard. But its not a hopeless case. An amendment for the ISO core standard wouldn’t be that difficult and is rather straight forward. It would
be simply to only consider prefix f and say:
f $STOPPER operand
f operator
Where $STOPPER ∈ {’,’, ‘|’, ‘)’, ‘}’, ‘]’, ‘.’}. This also covers the old (f).
Infix and postfix do not need some special treatment.
There is no straight forward way to convert a
SWI-Prolog text into a Scryer Prolog text?
listing/[0,1] doesn't work:
?- [user].
foo(+,-,-).
^D
?- listing(foo/3).
foo(+, -, -).
On first sight I though listing would work,
because SWI-Prolog is notorious for inserting
(f), for example I see this here:
?- X = (- - -).
X = - - (-).
But interestingly it does already not insert
(f) in the foo/3 case. Cool.
Mostowski Collapse schrieb am Donnerstag, 24. Februar 2022 um 17:17:38 UTC+1:
Being lazy and stupid is no excuse.
Having Scryer Prolog requiring me to write:
: -mode decomp((+),(-),(-)).
is the most idiotic thing in Prolog history.
Being lazy and stupid is no excuse.
Having Scryer Prolog requiring me to write:
: -mode decomp((+),(-),(-)).
is the most idiotic thing in Prolog history.
It is clear that the clown UWN downvotes this feature request, because
UWN opposes a living standard prolog. Scryer Prolog already implements
living standard, since it accepts for example foo(+,-,-) and current_op(X,Y,+).
Why stop half way, and implement living standard prolog only 50%.
SWI-Prolog is much better off, it has a larger stopper set. And therefore
can read TPTP Syntax. Scryer Prolog on the other hand has only implemented
the strategy of the living standard half way.
Feature request , add period to the operator stoppers #1297 https://github.com/mthom/scryer-prolog/issues/1297
Mostowski Collapse schrieb am Freitag, 25. Februar 2022 um 12:09:46 UTC+1:
Ok Scryer Prolog already handles this case:
?- [user].
foo(+, -, -).
^D
It doesn't bark. So what is missing? Why does
TPTP Syntax not work?
Mostowski Collapse schrieb am Freitag, 25. Februar 2022 um 12:06:05 UTC+1:
There is no straight forward way to convert a
SWI-Prolog text into a Scryer Prolog text?
listing/[0,1] doesn't work:
?- [user].
foo(+,-,-).
^D
?- listing(foo/3).
foo(+, -, -).
On first sight I though listing would work,
because SWI-Prolog is notorious for inserting
(f), for example I see this here:
?- X = (- - -).
X = - - (-).
But interestingly it does already not insert
(f) in the foo/3 case. Cool.
Mostowski Collapse schrieb am Donnerstag, 24. Februar 2022 um 17:17:38 UTC+1:
Being lazy and stupid is no excuse.
Having Scryer Prolog requiring me to write:
: -mode decomp((+),(-),(-)).
is the most idiotic thing in Prolog history.
Ha Ha, GNU Prolog cant do it either:
?- op(200,fy,!).
yes
?- X = foo(!).
X = foo(!)
?- X = (foo :- !).
uncaught exception: error(syntax_error('user_input:1 (char:80) expression expected or previous operator needs brackets'),read_term/3)
On the other hand TauProlog can do it:
/* Tau Prolog 0.3.2 (beta) */
?- op(200,fy,!).
true.
?- X = foo(!).
X = foo(!)
?- X = (foo :- !).
X = (foo:-!).
Was only testing the stopper ')'. It seems the stopper
')' is differently handled in GNU Prolog, depending on whether
the expression is simple as in foo(!) or more complex
as in (foo :- !). This could be the cause of the reduced
flexibility in parsing of GNU Prolog. Possibly Scryer Prolog
adopted the same inflexibility.
Ok Scryer Prolog already handles this case:
?- [user].
foo(+, -, -).
^D
It doesn't bark. So what is missing? Why does
TPTP Syntax not work?
Mostowski Collapse schrieb am Freitag, 25. Februar 2022 um 12:06:05 UTC+1:
There is no straight forward way to convert a
SWI-Prolog text into a Scryer Prolog text?
listing/[0,1] doesn't work:
?- [user].
foo(+,-,-).
^D
?- listing(foo/3).
foo(+, -, -).
On first sight I though listing would work,
because SWI-Prolog is notorious for inserting
(f), for example I see this here:
?- X = (- - -).
X = - - (-).
But interestingly it does already not insert
(f) in the foo/3 case. Cool.
Mostowski Collapse schrieb am Donnerstag, 24. Februar 2022 um 17:17:38 UTC+1:
Being lazy and stupid is no excuse.
Having Scryer Prolog requiring me to write:
: -mode decomp((+),(-),(-)).
is the most idiotic thing in Prolog history.
BTW: Living standard Prolog is probably the correct name to address
the issue. Scryer Prolog also fails this living standard Prolog test:
$ target/release/scryer-prolog
?- op(200,fy,!).
true.
?- X = foo(!).
X = foo(!).
?- X = (foo :- !).
caught: error(syntax_error(incomplete_reduction),read_term/3:1)
Mostowski Collapse schrieb am Freitag, 25. Februar 2022 um 13:02:54 UTC+1:
Ha Ha, GNU Prolog cant do it either:
?- op(200,fy,!).
yes
?- X = foo(!).
X = foo(!)
?- X = (foo :- !).
uncaught exception: error(syntax_error('user_input:1 (char:80) expression expected or previous operator needs brackets'),read_term/3)
On the other hand TauProlog can do it:
/* Tau Prolog 0.3.2 (beta) */
?- op(200,fy,!).
true.
?- X = foo(!).
X = foo(!)
?- X = (foo :- !).
X = (foo:-!).
Was only testing the stopper ')'. It seems the stopper
')' is differently handled in GNU Prolog, depending on whether
the expression is simple as in foo(!) or more complex
as in (foo :- !). This could be the cause of the reduced
flexibility in parsing of GNU Prolog. Possibly Scryer Prolog
adopted the same inflexibility.
Is the living standard Prolog a bad thing. Rather not,
it rather safeguards to some problems that Prolog
always bugs. For example a pair A-B might be rather
a bad idea, because ‘-’ is infix and prefix. Here it works fine:
?- X = (!-a), write_canonical(X), nl.
-(!,a)
X = !-a.
?- X = (!,a), write_canonical(X), nl.
','(!,a)
X = (!, a).
But it happened that I loaded the TPTP syntax, and things started going wrong:
/* SWI-Prolog */
?- op(200,fy,!).
true.
?- X = (!-a), write_canonical(X), nl.
!(-(a))
X = !-a.
?- X = (!,a), write_canonical(X), nl.
','(!,a)
X = ((!), a).
But at least the stopper ',' helps that the (A,B) pair still works.
Mostowski Collapse schrieb am Freitag, 25. Februar 2022 um 13:04:24 UTC+1:
BTW: Living standard Prolog is probably the correct name to address
the issue. Scryer Prolog also fails this living standard Prolog test:
$ target/release/scryer-prolog
?- op(200,fy,!).
true.
?- X = foo(!).
X = foo(!).
?- X = (foo :- !).
caught: error(syntax_error(incomplete_reduction),read_term/3:1)
Mostowski Collapse schrieb am Freitag, 25. Februar 2022 um 13:02:54 UTC+1:
Ha Ha, GNU Prolog cant do it either:
?- op(200,fy,!).
yes
?- X = foo(!).
X = foo(!)
?- X = (foo :- !).
uncaught exception: error(syntax_error('user_input:1 (char:80) expression expected or previous operator needs brackets'),read_term/3)
On the other hand TauProlog can do it:
/* Tau Prolog 0.3.2 (beta) */
?- op(200,fy,!).
true.
?- X = foo(!).
X = foo(!)
?- X = (foo :- !).
X = (foo:-!).
Was only testing the stopper ')'. It seems the stopper
')' is differently handled in GNU Prolog, depending on whether
the expression is simple as in foo(!) or more complex
as in (foo :- !). This could be the cause of the reduced
flexibility in parsing of GNU Prolog. Possibly Scryer Prolog
adopted the same inflexibility.
In Scryer Prolog I cannot use (A,B) either:
?- op(200,fy,!).
true.
?- X = (!-a), write_canonical(X), nl.
!(-(a))
X = !- a.
?- X = (!,a), write_canonical(X), nl.
caught: error(syntax_error(incomplete_reduction),read_term/3:1)
Mostowski Collapse schrieb am Freitag, 25. Februar 2022 um 16:55:17 UTC+1:
Is the living standard Prolog a bad thing. Rather not,
it rather safeguards to some problems that Prolog
always bugs. For example a pair A-B might be rather
a bad idea, because ‘-’ is infix and prefix. Here it works fine:
?- X = (!-a), write_canonical(X), nl.
-(!,a)
X = !-a.
?- X = (!,a), write_canonical(X), nl.
','(!,a)
X = (!, a).
But it happened that I loaded the TPTP syntax, and things started going wrong:
/* SWI-Prolog */
?- op(200,fy,!).
true.
?- X = (!-a), write_canonical(X), nl.
!(-(a))
X = !-a.
?- X = (!,a), write_canonical(X), nl.
','(!,a)
X = ((!), a).
But at least the stopper ',' helps that the (A,B) pair still works. Mostowski Collapse schrieb am Freitag, 25. Februar 2022 um 13:04:24 UTC+1:
BTW: Living standard Prolog is probably the correct name to address
the issue. Scryer Prolog also fails this living standard Prolog test:
$ target/release/scryer-prolog
?- op(200,fy,!).
true.
?- X = foo(!).
X = foo(!).
?- X = (foo :- !).
caught: error(syntax_error(incomplete_reduction),read_term/3:1) Mostowski Collapse schrieb am Freitag, 25. Februar 2022 um 13:02:54 UTC+1:
Ha Ha, GNU Prolog cant do it either:
?- op(200,fy,!).
yes
?- X = foo(!).
X = foo(!)
?- X = (foo :- !).
uncaught exception: error(syntax_error('user_input:1 (char:80) expression expected or previous operator needs brackets'),read_term/3)
On the other hand TauProlog can do it:
/* Tau Prolog 0.3.2 (beta) */
?- op(200,fy,!).
true.
?- X = foo(!).
X = foo(!)
?- X = (foo :- !).
X = (foo:-!).
Was only testing the stopper ')'. It seems the stopper
')' is differently handled in GNU Prolog, depending on whether
the expression is simple as in foo(!) or more complex
as in (foo :- !). This could be the cause of the reduced
flexibility in parsing of GNU Prolog. Possibly Scryer Prolog
adopted the same inflexibility.
Ok I found a way to convert legacy Prolog text into Scryer Prolog
format. The steps are relatively simple:
1) Consult the Prolog text in SWI-Prolog
2) Call listing/[0,1] in SWI-Prolog
SWI-Prolog puts an additional parenthesis around operators, even
when they were not there during input. So for example I get now:
?- listing(prove2/_).
prove2(?[X]:Fml, UnExp, Lits, FreeV, VarLim) :-
VarLim>0,
(!),
copy_term((X, Fml, FreeV),
(X1, Fml1, FreeV)),
append(UnExp, [?[X]:Fml], UnExp1),
VarLim2 is VarLim+ -1,
prove2(Fml1,
UnExp1,
Lits,
[X1|FreeV],
VarLim2)
The SWI-Prolog output seems to have sufficient quality so that
I can run it with Scryer Prolog, redoing my benchmarks gives me:
?- time((between(1,10,_), test(time, seq), fail; true)).
% CPU time: 0.435s
true.
?- time((between(1,10,_), test(time, tap), fail; true)).
% CPU time: 0.197s
true.
Thanks to this automatic conversion, I am now willingly to test more
TPTP stuff. Like for example to test also leanTap= and leanSeq= as
I did for SWI-Prolog WASM.
Its the most crazy thing I have ever seen, that such
a conversion step is necessary. Every sane person
might ask the following question:
- Why can SWI-Prolog parse it in the first place,
obviously correctly, since the code executes ok?
- And why can't Scryer Prolog parse it in the
first place? What is the ISO core standard worth,
when it cannot read legacy Prolog texts, that
is obviously unambigiously readable?
So many question marks now!!!
Mostowski Collapse schrieb am Freitag, 25. Februar 2022 um 21:39:04 UTC+1:
Ok I found a way to convert legacy Prolog text into Scryer Prolog
format. The steps are relatively simple:
1) Consult the Prolog text in SWI-Prolog
2) Call listing/[0,1] in SWI-Prolog
SWI-Prolog puts an additional parenthesis around operators, even
when they were not there during input. So for example I get now:
?- listing(prove2/_).
prove2(?[X]:Fml, UnExp, Lits, FreeV, VarLim) :-
VarLim>0,
(!),
copy_term((X, Fml, FreeV),
(X1, Fml1, FreeV)),
append(UnExp, [?[X]:Fml], UnExp1),
VarLim2 is VarLim+ -1,
prove2(Fml1,
UnExp1,
Lits,
[X1|FreeV],
VarLim2)
The SWI-Prolog output seems to have sufficient quality so that
I can run it with Scryer Prolog, redoing my benchmarks gives me:
?- time((between(1,10,_), test(time, seq), fail; true)).
% CPU time: 0.435s
true.
?- time((between(1,10,_), test(time, tap), fail; true)).
% CPU time: 0.197s
true.
Thanks to this automatic conversion, I am now willingly to test more
TPTP stuff. Like for example to test also leanTap= and leanSeq= as
I did for SWI-Prolog WASM.
Maybe I should also add this to the latest Dogelog player
milestone. I have this in formerly Jekejeke Prolog.
But I didn't check yet Scryer Prolog nor Tau-Prolog.
Also Dogelog player has not yet call/n and also
not yet predsort/3. There is a little asymmetry in Prolog,
that there is no number_compare/3 for the number
comparison, whereas we have compare/3 for syntactic
comparison. If one use a predicate that adheres to the
argument arrangement and return value of compare/3,
you could use it with predsort/3 of SWI-Prolog provenience:
?- sort([1, 1.0], L).
L = [1.0, 1].
?- predsort(number_compare, [1, 1.0], L).
L = [1].
I used this implementation, but I don’t know whether I
should recommend it:
number_compare(R, X, Y) :- X < Y, !, R = < .
number_compare(R, X, Y) ;- X =:= Y, !, R = = .
number_compare(>, _, _).
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (2 / 14) |
Uptime: | 66:51:30 |
Calls: | 6,654 |
Files: | 12,200 |
Messages: | 5,331,946 |