Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.prolog > #13097 > unrolled thread
| Started by | Mostowski Collapse <bursejan@gmail.com> |
|---|---|
| First post | 2022-08-10 00:28 -0700 |
| Last post | 2024-02-14 04:39 -0800 |
| Articles | 20 on this page of 53 — 4 participants |
Back to article view | Back to comp.lang.prolog
Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-10 00:28 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-10 00:29 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-10 01:20 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-11 05:41 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-11 05:52 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-11 06:23 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-11 08:27 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-12 06:49 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-12 06:54 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-12 06:56 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 01:48 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 07:37 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 07:38 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 07:39 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 07:47 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 07:59 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-14 08:12 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-20 04:41 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-20 04:42 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-20 11:22 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-20 11:25 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-21 00:57 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-22 19:30 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-22 19:31 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-24 06:08 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-24 06:10 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-24 06:38 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-24 12:18 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-09-04 14:19 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-09-15 14:09 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <janburse@fastmail.fm> - 2022-09-16 02:54 +0200
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-10-06 12:43 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-10-06 12:46 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-10-06 12:48 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-24 11:01 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2022-08-24 11:02 -0700
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2023-03-09 08:47 -0800
Re: Request for comments, async ISO core standard I/O Mostowski Collapse <bursejan@gmail.com> - 2023-03-09 08:53 -0800
Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-02-22 11:18 +0100
Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-02-22 11:26 +0100
Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-22 03:49 -0800
Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-03-05 15:08 +0100
Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-03-16 01:29 +0100
Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-03-16 01:39 +0100
Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-03-16 01:48 +0100
Re: Request for comments, async ISO core standard I/O Mild Shock <janburse@fastmail.fm> - 2024-03-16 01:53 +0100
Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-01 14:01 -0800
Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-01 14:09 -0800
Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-01 14:16 -0800
Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-14 03:38 -0800
Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-14 03:48 -0800
Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-14 04:01 -0800
Re: Request for comments, async ISO core standard I/O Mild Shock <bursejan@gmail.com> - 2024-02-14 04:39 -0800
Page 2 of 3 — ← Prev page 1 [2] 3 Next page →
| From | Mostowski Collapse <bursejan@gmail.com> |
|---|---|
| Date | 2022-08-20 11:25 -0700 |
| Message-ID | <17ecd837-c4c2-483f-95ad-4581a7308e13n@googlegroups.com> |
| In reply to | #13170 |
Its both with shift/1 ! Mostowski Collapse schrieb am Samstag, 20. August 2022 um 20:22:38 UTC+2: > Quite an amazing test case: > > /* SWI-Prolog 8.5.14 */ > ?- time(run_state(fib(25), 0, S)). > % 2,306,455 inferences, 0.453 CPU in 0.499 seconds > (91% CPU, 5090108 Lips) > S = 121393 . > > /* Scryer Prolog 0.9.0 */ > ?- time(run_state(fib(25), 0, S)). > % CPU time: 12.532s > S = 121393
[toc] | [prev] | [next] | [standalone]
| From | Mostowski Collapse <bursejan@gmail.com> |
|---|---|
| Date | 2022-08-21 00:57 -0700 |
| Message-ID | <36a41cb2-3d6c-44df-a20b-2502576c1f15n@googlegroups.com> |
| In reply to | #13171 |
Are the shift/1 solution and the engine_yield/1 solution semantically equivalent at the moment. The answer is no! /* shift/1 solution */ ?- run_state((inc(1), (inc(2); inc(4))), 0, S). S = 3 ; S = 5. /* engine_yield/1 solution */ ?- run_state((inc(1), (inc(2); inc(4))), 0, S). S = 3 ; S = 7 ; false. Can we nevertheless possibly implement shift/reset via engines? I wouldn't exclude this possibility, and it might indeed give faster shift/reset. Mostowski Collapse schrieb am Samstag, 20. August 2022 um 20:26:00 UTC+2: > Its both with shift/1 ! > Mostowski Collapse schrieb am Samstag, 20. August 2022 um 20:22:38 UTC+2: > > Quite an amazing test case: > > > > /* SWI-Prolog 8.5.14 */ > > ?- time(run_state(fib(25), 0, S)). > > % 2,306,455 inferences, 0.453 CPU in 0.499 seconds > > (91% CPU, 5090108 Lips) > > S = 121393 . > > > > /* Scryer Prolog 0.9.0 */ > > ?- time(run_state(fib(25), 0, S)). > > % CPU time: 12.532s > > S = 121393
[toc] | [prev] | [next] | [standalone]
| From | Mostowski Collapse <bursejan@gmail.com> |
|---|---|
| Date | 2022-08-22 19:30 -0700 |
| Message-ID | <cafec151-5885-4165-8265-6044168fe386n@googlegroups.com> |
| In reply to | #13172 |
Pitty the CW631 paper here: https://www.cs.kuleuven.be/publicaties/rapporten/cw/CW631.pdf doesn’t show Felleisen prompt/control implemented with difference lists: /* Vanilla conjunction list solve/1 extended to control/3 */ control([], none, []). control([prompt(A)|B], A, B). control([control(L, P, Q)|B], X, Y) :- control(L, P, Q), control(B, X, Y). control([A|B], X, Y) :- rule(A,C,B), control(C, X, Y). /* Difference List variant of clause/2 */ rule(sum(A+B),[prompt(ask(A)),prompt(ask(B))|R],R). rule(with_list(G,P,Q),[control(G,T,C),with_list2(T,C,P,Q)|R],R). rule(with_list2(none,_,P,P),R,R). rule(with_list2(ask(X),C,[X|P],Q),[with_list(C,P,Q)|R],R). Works fine: ?- control([with_list([sum(S)],[1,2,3],L)],_,_). S = 1+2, L = [3] .
[toc] | [prev] | [next] | [standalone]
| From | Mostowski Collapse <bursejan@gmail.com> |
|---|---|
| Date | 2022-08-22 19:31 -0700 |
| Message-ID | <83b94e8c-5aca-4950-923e-7e7bf8159eean@googlegroups.com> |
| In reply to | #13173 |
Its quite fast, since it does nothing with the continuation, just takes it as is, which I suppose is the spirit of Felleisen. Here the good ole shift/reset: /* SWI-Prolog 8.5.14 */ ?- time(run_state(fib(25), 0, S)). % 2,306,455 inferences, 0.453 CPU in 0.499 seconds (91% CPU, 5090108 Lips) S = 121393 . And here the prompt/control: /* SWI-Prolog 8.5.14 */ ?- time(control([run_state([fib(25)],0,S)],_,_)). % 3,641,788 inferences, 0.891 CPU in 0.980 seconds (91% CPU, 4089025 Lips) S = 121393 . /* Jekejeke Prolog 1.5.4, only 512 MB allocated, JDK 16 */ ?- time(control([run_state([fib(25)],0,S)],_,_)). % Threads 1,656 ms, GC 404 ms, Up 2,086 ms (Current 08/23/22 04:19:56) S = 121393 Mostowski Collapse schrieb am Dienstag, 23. August 2022 um 04:30:07 UTC+2: > Pitty the CW631 paper here: > https://www.cs.kuleuven.be/publicaties/rapporten/cw/CW631.pdf > > doesn’t show Felleisen prompt/control implemented with difference lists: > > /* Vanilla conjunction list solve/1 extended to control/3 */ > control([], none, []). > control([prompt(A)|B], A, B). > control([control(L, P, Q)|B], X, Y) :- control(L, P, Q), control(B, X, Y). > control([A|B], X, Y) :- rule(A,C,B), control(C, X, Y). > > /* Difference List variant of clause/2 */ > rule(sum(A+B),[prompt(ask(A)),prompt(ask(B))|R],R). > rule(with_list(G,P,Q),[control(G,T,C),with_list2(T,C,P,Q)|R],R). > rule(with_list2(none,_,P,P),R,R). > rule(with_list2(ask(X),C,[X|P],Q),[with_list(C,P,Q)|R],R). > > Works fine: > > ?- control([with_list([sum(S)],[1,2,3],L)],_,_). > S = 1+2, > L = [3] .
[toc] | [prev] | [next] | [standalone]
| From | Mostowski Collapse <bursejan@gmail.com> |
|---|---|
| Date | 2022-08-24 06:08 -0700 |
| Message-ID | <de49e8f1-1409-40b2-b60b-94aab4492e72n@googlegroups.com> |
| In reply to | #13111 |
Mostowski Collapse schrieb am Donnerstag, 11. August 2022 um 17:27:36 UTC+2: > Thats just your humanly ape brain acceptance curve: > - Resistance > - Denial > - Exploration > - Commitment If you are a slow thinker, you pass these quadrants slowly, maybe you never reach the end. Here is an example of a slow thinker, Ulrich Neumerkel, concerning Unicode: bla bla bla TPTP and bla bla bla WG21/N3146 https://www.tptp.org/TPTP/SyntaxBNF.html#lower_alpha https://github.com/mthom/scryer-prolog/issues/1515#issuecomment-1225242783 https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3146.html LoL
[toc] | [prev] | [next] | [standalone]
| From | Mostowski Collapse <bursejan@gmail.com> |
|---|---|
| Date | 2022-08-24 06:10 -0700 |
| Message-ID | <30228514-d7f4-457f-9ed9-6b8b16617718n@googlegroups.com> |
| In reply to | #13175 |
If you would like to be TPTP compatible (versus v8.1.0.0),
you would need to ban this:
$ target/release/scryer-prolog -v
"v0.9.0-181-g8e9302ea"
$ target/release/scryer-prolog
?- X = hörgerät.
X = hörgerät.
So Scryer Prolog is now somewhere between TPTP
and a Prolog Unicode, neither fish nor fowl,
I cannot parse this, doesn't work in Scryer Prolog:
$ cat text.pl
text("«The Logos of Cybele is the idea that the Great Mother creates\n\
and kills everything. It is not eternity (Apollo) or the circle\n\
(Dionysus), but something that acts in her way with blind\n\
and absolute power. A form of progress: bottom-up growth.\n\
We are experiencing the final attack of Cybele, of the Great Risen\n\
Mother, with feminism, artificial intelligence, globalization,\n\
democracy, liberalism, and so on»").
I get this error:
$ target/release/scryer-prolog
?- ['text.pl'].
error(syntax_error(missing_quote),read_term/3:0).
false.
Works fine in SWI-Prolog:
?- text(X), write(X), nl, fail; true.
«The Logos of Cybele is the idea that the Great Mother creates
and kills everything. It is not eternity (Apollo) or the circle
(Dionysus), but something that acts in her way with blind
and absolute power. A form of progress: bottom-up growth.
We are experiencing the final attack of Cybele, of the Great Risen
Mother, with feminism, artificial intelligence, globalization,
democracy, liberalism, and so on»
true.
Mostowski Collapse schrieb am Mittwoch, 24. August 2022 um 15:08:40 UTC+2:
> Mostowski Collapse schrieb am Donnerstag, 11. August 2022 um 17:27:36 UTC+2:
> > Thats just your humanly ape brain acceptance curve:
> > - Resistance
> > - Denial
> > - Exploration
> > - Commitment
> If you are a slow thinker, you pass these quadrants slowly,
> maybe you never reach the end. Here is an example of a
> slow thinker, Ulrich Neumerkel, concerning Unicode:
>
> bla bla bla TPTP and bla bla bla WG21/N3146
> https://www.tptp.org/TPTP/SyntaxBNF.html#lower_alpha
> https://github.com/mthom/scryer-prolog/issues/1515#issuecomment-1225242783
> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3146.html
>
> LoL
[toc] | [prev] | [next] | [standalone]
| From | Mostowski Collapse <bursejan@gmail.com> |
|---|---|
| Date | 2022-08-24 06:38 -0700 |
| Message-ID | <166fdad7-1a4e-42d1-8b99-6675db8b7442n@googlegroups.com> |
| In reply to | #13176 |
Holy Cow, Logtalk is the converse of Ciao Prolog. Its kind of the inverted image of the library(lists) of Ciao Prolog. What Logtalk has: subtract([], _, []). subtract([Head| Tail], List, Rest) :- ( memberchk(Head, List) -> subtract(Tail, List, Rest) ; Rest = [Head| Tail2], subtract(Tail, List, Tail2) ). is not in Ciao Prolog. And vice versa, like union/3, interaction/3, etc.. is missing from lists. So if Ciao Prolog would load Logtalk it would have everything?
[toc] | [prev] | [next] | [standalone]
| From | Mostowski Collapse <bursejan@gmail.com> |
|---|---|
| Date | 2022-08-24 12:18 -0700 |
| Message-ID | <b8cb57a7-2a98-48fd-ab7a-9d75ade2e009n@googlegroups.com> |
| In reply to | #13177 |
Slow thinking can lead to constant pain! LoL
Logtalk is writing nonsense:
Union, intersection, ... are set operations. Subtract is not.
https://github.com/LogtalkDotOrg/logtalk3/issues/150#issuecomment-1226084264
Then correcting it to:
Union, intersection, ... are set operations. Subtract is not a set only operation.
Ha Ha, when you have no clue how Prolog works. Union and
Intersection are also "not a set only operation", what ever that
means. They are in the same category like Subtract.
Come on guys, its not so difficult! sets.lgt has also subtract:
subtract(Set, [], Set) :- !.
subtract([], _, []) :- !.
subtract([Head1| Tail1], [Head2| Tail2], Difference) :-
compare(Order, Head1, Head2),
subtract(Order, Head1, Tail1, Head2, Tail2, Difference).
subtract(=, _, Tail1, _, Tail2, Difference) :-
subtract(Tail1, Tail2, Difference).
subtract(<, Head1, Tail1, Head2, Tail2, [Head1| Difference]) :-
subtract(Tail1, [Head2| Tail2], Difference).
subtract(>, Head1, Tail1, _, Tail2, Difference) :-
subtract([Head1| Tail1], Tail2, Difference).
In SWI-Prolog its clearer since there is no name overloading:
https://www.swi-prolog.org/pldoc/doc_for?object=ord_subtract/3
P.S.: Mathematically we would write P \ Q for the set difference.
https://mathworld.wolfram.com/SetDifference.html
Mostowski Collapse schrieb am Mittwoch, 24. August 2022 um 15:38:15 UTC+2:
> Holy Cow, Logtalk is the converse of Ciao Prolog.
> Its kind of the inverted image of the library(lists)
> of Ciao Prolog. What Logtalk has:
>
> subtract([], _, []).
> subtract([Head| Tail], List, Rest) :-
> ( memberchk(Head, List) ->
> subtract(Tail, List, Rest)
> ; Rest = [Head| Tail2],
> subtract(Tail, List, Tail2)
> ).
>
> is not in Ciao Prolog. And vice versa, like
> union/3, interaction/3, etc.. is missing from lists.
> So if Ciao Prolog would load Logtalk it
>
> would have everything?
[toc] | [prev] | [next] | [standalone]
| From | Mostowski Collapse <bursejan@gmail.com> |
|---|---|
| Date | 2022-09-04 14:19 -0700 |
| Message-ID | <8e2bd0c4-0976-48f1-917f-dda7c99bc840n@googlegroups.com> |
| In reply to | #13180 |
These are some ultra cute graphics! Cooperative Multitasking Visualized - Tau Prolog, 2022 http://tau-prolog.org/files/prole2022/#/4/4 Noice!
[toc] | [prev] | [next] | [standalone]
| From | Mostowski Collapse <bursejan@gmail.com> |
|---|---|
| Date | 2022-09-15 14:09 -0700 |
| Message-ID | <8bc2353f-611a-4cee-a0ac-e63e43d4fcf5n@googlegroups.com> |
| In reply to | #13213 |
Why not load small JavaScript snippets synchronously
in the browser? This one works for me. At least
some local testing works already, its not yet deployed:
let parent = "";
let cache = {};
/**
* Load a JavaScript text synchronously.
*
* @param url The url.
*/
function cludge(url) {
/* resolve and check */
if (parent !== "")
url = new URL(url, parent).href;
let map = cache[url];
if (map !== undefined)
return map;
map = {};
cache[url] = map;
/* load and execute */
let back = parent;
try {
parent = url;
let request = new XMLHttpRequest();
request.open('GET', url, false);
request.send();
let fun = new Function("exports", "require", request.responseText);
fun(map, cludge);
} finally {
parent = back;
}
return map;
}
Have Fun!
[toc] | [prev] | [next] | [standalone]
| From | Mostowski Collapse <janburse@fastmail.fm> |
|---|---|
| Date | 2022-09-16 02:54 +0200 |
| Message-ID | <tg0hgd$6n2t$1@solani.org> |
| In reply to | #13227 |
On second though, I will not use this piece
of code, rather should work more consequently
in keeping the overal code async and the examples
async as well, so that it wont happen, that the browser
blocks. From GUI viewpoint its not so trivial
to make it async compatible. There are few tricks
needed. If there is only one action button this
works to avoid that multiple Prolog interpreter
calls are spawned:
async function main_async() {
document.getElementById("launch").disabled = true;
try {
async bla bla
} finally {
document.getElementById("launch").disabled = false;
}
}
document.getElementById("launch")
.addEventListener("click", main_async);
But if there are multiple action buttons,
more work is needed.
Mostowski Collapse schrieb:
> Why not load small JavaScript snippets synchronously
> in the browser? This one works for me. At least
> some local testing works already, its not yet deployed:
>
> let parent = "";
> let cache = {};
>
> /**
> * Load a JavaScript text synchronously.
> *
> * @param url The url.
> */
> function cludge(url) {
> /* resolve and check */
> if (parent !== "")
> url = new URL(url, parent).href;
> let map = cache[url];
> if (map !== undefined)
> return map;
> map = {};
> cache[url] = map;
>
> /* load and execute */
> let back = parent;
> try {
> parent = url;
> let request = new XMLHttpRequest();
> request.open('GET', url, false);
> request.send();
> let fun = new Function("exports", "require", request.responseText);
> fun(map, cludge);
> } finally {
> parent = back;
> }
> return map;
> }
>
> Have Fun!
>
[toc] | [prev] | [next] | [standalone]
| From | Mostowski Collapse <bursejan@gmail.com> |
|---|---|
| Date | 2022-10-06 12:43 -0700 |
| Message-ID | <66785d81-f3d4-4c6b-abc8-3a6c8d2d1f68n@googlegroups.com> |
| In reply to | #13228 |
How would the world look like, if Paul Tarau would not have written a paper about Prolog engines years ago, but about Prolog promisses? Is there even such a paper already? SWI-Prolog with its await/2 is quite advanced, they have promise objects passing created by (:=)/2 and then can be passed to await/2. In Dogelog player promisses are still opaque, not visible in Prolog sphere as it is actually the case in SWI-Prolog WASM. But the idea of enginess still sticks to the mind!
[toc] | [prev] | [next] | [standalone]
| From | Mostowski Collapse <bursejan@gmail.com> |
|---|---|
| Date | 2022-10-06 12:46 -0700 |
| Message-ID | <ec09b0a4-6dd5-4cfb-8979-1641c4dd12a6n@googlegroups.com> |
| In reply to | #13271 |
Recent version of Dogelog uses import(), this is a JavaScript function which returns a promise. Behind this promise is loading and evaluating JavaScript code, and I could show how to transpile WordNet to JavaScript, and then load it via import(). Its quite fast! But can we make it parallel without going into engines? Maybe use this syntax for parallel import. A list wrapped into a singleton list. Or use some flag to control it, since a default parallel behaviour could be too dangerous? /* Parallel Variant Syntax of Multi-Consult ? */ ?- [['foo.p', 'bar.p', 'baz.p']]. Of course engines or what Tau Prolog did with tasks and promises, could also lead to a parallel load. Maybe can get away with a cheaper solution, not bring tasks to Dogelog player, only juggle with import() ? Mostowski Collapse schrieb am Donnerstag, 6. Oktober 2022 um 21:43:06 UTC+2: > How would the world look like, if Paul Tarau would > not have written a paper about Prolog engines years > ago, but about Prolog promisses? Is there even such > > a paper already? SWI-Prolog with its await/2 is quite > advanced, they have promise objects passing created > by (:=)/2 and then can be passed to await/2. In Dogelog > > player promisses are still opaque, not visible in Prolog > sphere as it is actually the case in SWI-Prolog WASM. > But the idea of enginess still sticks to the mind!
[toc] | [prev] | [next] | [standalone]
| From | Mostowski Collapse <bursejan@gmail.com> |
|---|---|
| Date | 2022-10-06 12:48 -0700 |
| Message-ID | <2a4d1895-0692-4b1d-a274-700e4875e017n@googlegroups.com> |
| In reply to | #13272 |
So what was rummaging in my brain. Why did I get repelled by the idea of engines. I don’t know, or maybe I know? Does SWI-Prolog have only this here, namely: await(+Promise, -Result) execution of await/2 completes when the Promise resolves and Result is unified with the value passed to the Promise.then() method. https://www.swi-prolog.org/pldoc/doc_for?object=await/2 How about a new await_all/2, that takes a promise list? What could be done with await_all/2? BTW: JavaScript has more in stock than only await_all/2 which would correspond to Promise.all(), there are like 1-2 other multi-waiters. Mostowski Collapse schrieb am Donnerstag, 6. Oktober 2022 um 21:46:51 UTC+2: > Recent version of Dogelog uses import(), this is a JavaScript > function which returns a promise. Behind this promise > is loading and evaluating JavaScript code, and I could > > show how to transpile WordNet to JavaScript, and then load > it via import(). Its quite fast! But can we make it parallel > without going into engines? Maybe use this syntax > > for parallel import. A list wrapped into a singleton list. Or use > some flag to control it, since a default parallel behaviour > could be too dangerous? > > /* Parallel Variant Syntax of Multi-Consult ? */ > ?- [['foo.p', 'bar.p', 'baz.p']]. > > Of course engines or what Tau Prolog did with tasks and > promises, could also lead to a parallel load. Maybe can get > away with a cheaper solution, not bring tasks to Dogelog > > player, only juggle with import() ? > Mostowski Collapse schrieb am Donnerstag, 6. Oktober 2022 um 21:43:06 UTC+2: > > How would the world look like, if Paul Tarau would > > not have written a paper about Prolog engines years > > ago, but about Prolog promisses? Is there even such > > > > a paper already? SWI-Prolog with its await/2 is quite > > advanced, they have promise objects passing created > > by (:=)/2 and then can be passed to await/2. In Dogelog > > > > player promisses are still opaque, not visible in Prolog > > sphere as it is actually the case in SWI-Prolog WASM. > > But the idea of enginess still sticks to the mind!
[toc] | [prev] | [next] | [standalone]
| From | Mostowski Collapse <bursejan@gmail.com> |
|---|---|
| Date | 2022-08-24 11:01 -0700 |
| Message-ID | <bcdd135e-3149-4a3e-8235-d2c0b283a7b0n@googlegroups.com> |
| In reply to | #13176 |
Slow thinking can lead to constant pain. Like here:
And, indeed, in the case of an atom the escaping is not necessary:
?- write('foo"bar').
foo"bar true.
https://github.com/mthom/scryer-prolog/issues/1552#issuecomment-1207677642
What does "not necessary" mean. Thats nonsense.
Wouldn't it be a better and less confusing explanation that write/1
must behave as putatom/1, and everything else would be a bug,
since it has quoted(false)?
At least this is what the ISO core standard tells me:
- ISO/IEC 13211-1:1995(E), Page 100
So basically write/1 will behave, concerning atoms
as if (in DEC-10 Dialect):
[...]
write(X) :- atom(X), name(X,L), putlist(L).
[...]
putlist([X|Y]) :- put(X), putlist(Y).
putlist([]).
Mostowski Collapse schrieb am Mittwoch, 24. August 2022 um 15:10:50 UTC+2:
> If you would like to be TPTP compatible (versus v8.1.0.0),
> you would need to ban this:
>
> $ target/release/scryer-prolog -v
> "v0.9.0-181-g8e9302ea"
> $ target/release/scryer-prolog
> ?- X = hörgerät.
> X = hörgerät.
>
> So Scryer Prolog is now somewhere between TPTP
> and a Prolog Unicode, neither fish nor fowl,
> I cannot parse this, doesn't work in Scryer Prolog:
>
> $ cat text.pl
> text("«The Logos of Cybele is the idea that the Great Mother creates\n\
> and kills everything. It is not eternity (Apollo) or the circle\n\
> (Dionysus), but something that acts in her way with blind\n\
> and absolute power. A form of progress: bottom-up growth.\n\
> We are experiencing the final attack of Cybele, of the Great Risen\n\
> Mother, with feminism, artificial intelligence, globalization,\n\
> democracy, liberalism, and so on»").
>
> I get this error:
>
> $ target/release/scryer-prolog
> ?- ['text.pl'].
> error(syntax_error(missing_quote),read_term/3:0).
> false.
>
> Works fine in SWI-Prolog:
>
> ?- text(X), write(X), nl, fail; true.
> «The Logos of Cybele is the idea that the Great Mother creates
> and kills everything. It is not eternity (Apollo) or the circle
> (Dionysus), but something that acts in her way with blind
> and absolute power. A form of progress: bottom-up growth.
> We are experiencing the final attack of Cybele, of the Great Risen
> Mother, with feminism, artificial intelligence, globalization,
> democracy, liberalism, and so on»
> true.
> Mostowski Collapse schrieb am Mittwoch, 24. August 2022 um 15:08:40 UTC+2:
> > Mostowski Collapse schrieb am Donnerstag, 11. August 2022 um 17:27:36 UTC+2:
> > > Thats just your humanly ape brain acceptance curve:
> > > - Resistance
> > > - Denial
> > > - Exploration
> > > - Commitment
> > If you are a slow thinker, you pass these quadrants slowly,
> > maybe you never reach the end. Here is an example of a
> > slow thinker, Ulrich Neumerkel, concerning Unicode:
> >
> > bla bla bla TPTP and bla bla bla WG21/N3146
> > https://www.tptp.org/TPTP/SyntaxBNF.html#lower_alpha
> > https://github.com/mthom/scryer-prolog/issues/1515#issuecomment-1225242783
> > https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3146.html
> >
> > LoL
[toc] | [prev] | [next] | [standalone]
| From | Mostowski Collapse <bursejan@gmail.com> |
|---|---|
| Date | 2022-08-24 11:02 -0700 |
| Message-ID | <dde0630c-4522-453c-b828-003008bea160n@googlegroups.com> |
| In reply to | #13178 |
Also, I don't find a putatom/1 in DEC-10 Manual from year 1982 here:
Department of Artificial Intelligence. University of Edinburgh
DECsystem-10 PROLOG USER'S MANUAL - 10 November 1982
https://userweb.fct.unl.pt/~lmp/publications/online-papers/DECsystem-10%20PROLOG%20USER%27S%20MANUAL.pdf
Where do you have an evidence, for the year 1978?
Mostowski Collapse schrieb am Mittwoch, 24. August 2022 um 20:01:15 UTC+2:
> Slow thinking can lead to constant pain. Like here:
>
> And, indeed, in the case of an atom the escaping is not necessary:
> ?- write('foo"bar').
> foo"bar true.
> https://github.com/mthom/scryer-prolog/issues/1552#issuecomment-1207677642
>
> What does "not necessary" mean. Thats nonsense.
>
> Wouldn't it be a better and less confusing explanation that write/1
> must behave as putatom/1, and everything else would be a bug,
> since it has quoted(false)?
>
> At least this is what the ISO core standard tells me:
>
> - ISO/IEC 13211-1:1995(E), Page 100
>
> So basically write/1 will behave, concerning atoms
> as if (in DEC-10 Dialect):
>
> [...]
> write(X) :- atom(X), name(X,L), putlist(L).
> [...]
>
> putlist([X|Y]) :- put(X), putlist(Y).
> putlist([]).
[toc] | [prev] | [next] | [standalone]
| From | Mostowski Collapse <bursejan@gmail.com> |
|---|---|
| Date | 2023-03-09 08:47 -0800 |
| Message-ID | <1f804201-3aa6-4fbc-b1c3-f3887b304675n@googlegroups.com> |
| In reply to | #13097 |
Dogelog Player is the avant garde of logic programming. How long is the adoption time by other Prolog systems? Depends, it can be 6 to 12 months. Example: Auto-yield was explained here: [Feb 3, 2022] Non-Blocking Browser for Dogelog Player https://medium.com/ It was adopted 6 months later by SWI-Prolog: [Aug 6 2022] ADDED: heartbeat mechanism: by setting the Prolog flag heartbeat, the multifile predicate heartbeat/0 is called every N inferences. https://www.swi-prolog.org/ And now it got adopted by Trealla Prolog: [March 8 2023] Yield tweaks for Wasm port #136 https://github.com/
[toc] | [prev] | [next] | [standalone]
| From | Mostowski Collapse <bursejan@gmail.com> |
|---|---|
| Date | 2023-03-09 08:53 -0800 |
| Message-ID | <64501abc-aae8-4e70-97f5-a9669a3e4174n@googlegroups.com> |
| In reply to | #13508 |
I now have complete my take on Task Contexts, there is an implementation, will soon write a medium article about it. They are different from Engines. Not sure whether Task Contexts will be adopted by some Prolog system. It requires a new and different thinking. You need to think beyond engines. Actually Task Contexts are independent of engines. You can add Task Contexts to a Prolog system with engines or to a Prolog system without engines. All you need is an event loop and stackless (non-fibers) and stackfull coroutines (fibers). No engines needed, unless you might want to implement the event loop and the non-fibers and fibers from engines? Would it perform? The problem is a calLlater/2 or create_task/1 as a side effect on the current engine loop is much more efficient then yielding for such a command. Thats why these methods in JavaScript are not some sort of promises that can be awaited: setTimeout() clearTimeout() They have an immediate effect on the event loop. Mostowski Collapse schrieb am Donnerstag, 9. März 2023 um 17:47:04 UTC+1: > Dogelog Player is the avant garde of logic programming. > How long is the adoption time by other Prolog systems? > Depends, it can be 6 to 12 months. Example: > > Auto-yield was explained here: > > [Feb 3, 2022] > Non-Blocking Browser for Dogelog Player > https://medium.com/ > > It was adopted 6 months later by SWI-Prolog: > > [Aug 6 2022] > ADDED: heartbeat mechanism: by setting the Prolog flag heartbeat, > the multifile predicate heartbeat/0 is called every N inferences. > https://www.swi-prolog.org/ > > And now it got adopted by Trealla Prolog: > > [March 8 2023] > Yield tweaks for Wasm port #136 > https://github.com/
[toc] | [prev] | [next] | [standalone]
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2024-02-22 11:18 +0100 |
| Message-ID | <ur771d$f2lp$1@solani.org> |
| In reply to | #13508 |
Now asyncifying I/O of Dogelog Player for Python.
I guess we got our head around the equivalents
of our Java Surrogate async/await constructs
"Promise" and "Coroutine". The key utilities among
asyncio are asyncio.to_thread an asyncio.run_coroutine_threadsafe,
which seem toe especially made for the two use cases.
Namely what was our Java Surrogate "Promise" wrapper,
now looks like here, what a wonderful code gem:
async def console_promise(buf, stream):
try:
res = await asyncio.to_thread(blocking_readline, stream.data)
stream.buf = res
stream.pos = 0
except IOError as err:
register_signal(buf, map_stream_error(err))
def blocking_readline(data):
return data.readline()
And what was our Java Surrogate "Coroutine" wrapper,
now looks like here, what a wonderful code gem again:
def test_sys_http_server_on(args):
[...]
obj.func = lambda req, res: baby_come_back(
launch_async(clause, buf, [req, res]), loop)
def baby_come_back(coro, loop):
future = asyncio.run_coroutine_threadsafe(coro, loop)
return future.result()
LoL
[toc] | [prev] | [next] | [standalone]
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Date | 2024-02-22 11:26 +0100 |
| Message-ID | <ur77gq$f2u5$1@solani.org> |
| In reply to | #13985 |
But its much more complicated than what we did
for JDK 21. Also starting the HTTP server in a separate
thread is extremly frightening:
def test_http_server_listen(args):
[...]
thread = threading.Thread(target=blocking_forever, args=(obj,))
thread.start()
def blocking_forever(obj):
obj.serve_forever()
Its extremly frightening since the Thread docu warns us:
Thread-based parallelism
In CPython, due to the Global Interpreter Lock,
only one thread can execute Python code at once
https://docs.python.org/3/library/threading.html
global interpreter lock
Also, the GIL is always released when doing I/O.
Past efforts to create a “free-threaded” interpreter
have not been successful
https://docs.python.org/3/glossary.html#term-global-interpreter-lock
But still, our use of asyncio.to_thread and
asyncio.run_coroutine_threadsafe capitalizes on
that the GIL is nevertheless released during I/O,
and we don't see much issue here.
Mild Shock schrieb:
> Now asyncifying I/O of Dogelog Player for Python.
> I guess we got our head around the equivalents
> of our Java Surrogate async/await constructs
>
> "Promise" and "Coroutine". The key utilities among
> asyncio are asyncio.to_thread an asyncio.run_coroutine_threadsafe,
> which seem toe especially made for the two use cases.
>
> Namely what was our Java Surrogate "Promise" wrapper,
> now looks like here, what a wonderful code gem:
>
>
> async def console_promise(buf, stream):
> try:
> res = await asyncio.to_thread(blocking_readline, stream.data)
> stream.buf = res
> stream.pos = 0
> except IOError as err:
> register_signal(buf, map_stream_error(err))
>
>
> def blocking_readline(data):
> return data.readline()
>
>
> And what was our Java Surrogate "Coroutine" wrapper,
> now looks like here, what a wonderful code gem again:
>
> def test_sys_http_server_on(args):
> [...]
> obj.func = lambda req, res: baby_come_back(
> launch_async(clause, buf, [req, res]), loop)
>
>
> def baby_come_back(coro, loop):
> future = asyncio.run_coroutine_threadsafe(coro, loop)
> return future.result()
>
> LoL
[toc] | [prev] | [next] | [standalone]
Page 2 of 3 — ← Prev page 1 [2] 3 Next page →
Back to top | Article view | comp.lang.prolog
csiph-web