• Request for comments, async ISO core standard I/O

    From Mostowski Collapse@21:1/5 to All on Wed Aug 10 00:28:40 2022
    Now I got an idea how to asyncify the ISO core standard I/O.
    The idea is very simple and I try to solve one problem: How
    can we make for example get_code/2 asyncified, without

    sacrificing performance? I came up with this sketch:

    get_code(S, C) :- get_code_buffered(S, C), !.
    get_code(S, C) :- async_read_buffer(S), get_code(S, C).

    There are some unresolved issues in the above code, like
    how return end of file, i.e. -1 or how to deal with surrogate pairs.
    But essentially the idea is that the stream S has a buffer

    somewhere and that the fast path is to read from this buffer,
    and we only need to yield when we replenish the buffer via
    some I/O. This could give a quite fast asyncified get_code/2.

    Is there any Prolog system that did already something like this?
    I always see that get_code/2 is a primitive and was also folllowing
    this approach in my systems so far. In the above I bootstrap it from two

    other primitives, a synchronous one and a asynchronous one,
    make it itself not anymore primitive. get_code_buffered/2 would
    fail if it has reached the end of the buffer.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Wed Aug 10 00:29:33 2022
    But there is a lot of work to do, peek_code/2 needs a similar
    treatment, and then in my system I have also get_atom/3, which
    would need some treatment. Scryer Prolog would go for the

    XXX_char predicates first, if they are present in a Prolog system
    they would also need some treatment. Also the Python and the
    JavaScript target might turn out different. In JavaScript there are

    different fetch modes, chunked and non-chunked. In non-chunked
    we might get the whole file in one go, a second call to async_read_buffer/1 would not exist. Chunked is related to what SWI-Prolog calls http

    streaming. I don’t know the details yet. And then maybe it should transparently choose something synchronous if asynchronous
    behaviour is not demanded from the Prolog interpreter at all.

    Mostowski Collapse schrieb am Mittwoch, 10. August 2022 um 09:28:41 UTC+2:
    Now I got an idea how to asyncify the ISO core standard I/O.
    The idea is very simple and I try to solve one problem: How
    can we make for example get_code/2 asyncified, without

    sacrificing performance? I came up with this sketch:

    get_code(S, C) :- get_code_buffered(S, C), !.
    get_code(S, C) :- async_read_buffer(S), get_code(S, C).

    There are some unresolved issues in the above code, like
    how return end of file, i.e. -1 or how to deal with surrogate pairs.
    But essentially the idea is that the stream S has a buffer

    somewhere and that the fast path is to read from this buffer,
    and we only need to yield when we replenish the buffer via
    some I/O. This could give a quite fast asyncified get_code/2.

    Is there any Prolog system that did already something like this?
    I always see that get_code/2 is a primitive and was also folllowing
    this approach in my systems so far. In the above I bootstrap it from two

    other primitives, a synchronous one and a asynchronous one,
    make it itself not anymore primitive. get_code_buffered/2 would
    fail if it has reached the end of the buffer.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Wed Aug 10 01:20:09 2022
    Concerning Scryer Prolog I find a mention of async here:

    socket_server_accept/4 cannot be interrupted with Ctrl-c https://github.com/mthom/scryer-prolog/issues/485

    But this was already a while ago, like 2020.
    And does Scryer Prolog have a yield instruction?

    Mostowski Collapse schrieb am Mittwoch, 10. August 2022 um 09:29:34 UTC+2:
    But there is a lot of work to do, peek_code/2 needs a similar
    treatment, and then in my system I have also get_atom/3, which
    would need some treatment. Scryer Prolog would go for the

    XXX_char predicates first, if they are present in a Prolog system
    they would also need some treatment. Also the Python and the
    JavaScript target might turn out different. In JavaScript there are

    different fetch modes, chunked and non-chunked. In non-chunked
    we might get the whole file in one go, a second call to async_read_buffer/1 would not exist. Chunked is related to what SWI-Prolog calls http

    streaming. I don’t know the details yet. And then maybe it should transparently choose something synchronous if asynchronous
    behaviour is not demanded from the Prolog interpreter at all.
    Mostowski Collapse schrieb am Mittwoch, 10. August 2022 um 09:28:41 UTC+2:
    Now I got an idea how to asyncify the ISO core standard I/O.
    The idea is very simple and I try to solve one problem: How
    can we make for example get_code/2 asyncified, without

    sacrificing performance? I came up with this sketch:

    get_code(S, C) :- get_code_buffered(S, C), !.
    get_code(S, C) :- async_read_buffer(S), get_code(S, C).

    There are some unresolved issues in the above code, like
    how return end of file, i.e. -1 or how to deal with surrogate pairs.
    But essentially the idea is that the stream S has a buffer

    somewhere and that the fast path is to read from this buffer,
    and we only need to yield when we replenish the buffer via
    some I/O. This could give a quite fast asyncified get_code/2.

    Is there any Prolog system that did already something like this?
    I always see that get_code/2 is a primitive and was also folllowing
    this approach in my systems so far. In the above I bootstrap it from two

    other primitives, a synchronous one and a asynchronous one,
    make it itself not anymore primitive. get_code_buffered/2 would
    fail if it has reached the end of the buffer.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Thu Aug 11 05:52:57 2022
    Since priorities are different, it will clearly take weeks
    or months, for a demonstration. Also there are not
    much shoulders to climb, at least I didn't find

    a lot of precedents, and who wants to climb giant
    morons? ClownProlog Nr. 2 is even not asyncified, they
    even don't know what this is. ClownProlog Nr. 1 could

    be better off, they seem to have a haze idea.

    LoL

    Mostowski Collapse schrieb am Donnerstag, 11. August 2022 um 14:41:20 UTC+2:
    'When a clown moves into a palace, he doesn't
    become a king. The palace becomes a circus.'

    -Turkish proverb

    Now we have two ClownPrologs:

    ClownProlog Nr. 1: Ciao Prolog:
    This here looks like a Prolog terminal in the browser,
    but doesn't behave like a Prolog terminal:
    https://ciao-lang.org/playground/
    Try read/1 etc.. Its documented that this is a limitation.

    ClownProlog Nr. 2: SWI-Prolog:
    Maybe inspired by Ciao Prolog playground, that they made
    quickly a rip off? Its a little better off, one can abort a query. https://dev.swi-prolog.org/wasm/shell
    But try read/1 etc..

    My proposal for async ISO core standard I/O could
    adress this problem. But interestingly its also not top
    priority for Dogelog. I just figured out that I need other

    stuff first. But Dogelog does not try to present the illusion
    of a terminal, when it does not yet have a terminal. None
    of the examples try to provide such a illusion.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to All on Thu Aug 11 05:41:19 2022
    'When a clown moves into a palace, he doesn't
    become a king. The palace becomes a circus.'

    -Turkish proverb

    Now we have two ClownPrologs:

    ClownProlog Nr. 1: Ciao Prolog:
    This here looks like a Prolog terminal in the browser,
    but doesn't behave like a Prolog terminal:
    https://ciao-lang.org/playground/
    Try read/1 etc.. Its documented that this is a limitation.

    ClownProlog Nr. 2: SWI-Prolog:
    Maybe inspired by Ciao Prolog playground, that they made
    quickly a rip off? Its a little better off, one can abort a query. https://dev.swi-prolog.org/wasm/shell
    But try read/1 etc..

    My proposal for async ISO core standard I/O could
    adress this problem. But interestingly its also not top
    priority for Dogelog. I just figured out that I need other

    stuff first. But Dogelog does not try to present the illusion
    of a terminal, when it does not yet have a terminal. None
    of the examples try to provide such a illusion.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Thu Aug 11 06:23:47 2022
    Why could be ClownProlog Nr. 1 better of.
    They have an async facade, at least their file
    says so ciao-async.js. Thats already a good

    start, although it has the unholy combination
    with a worker. ClownProlog Nr. 2 demonstrates
    a solution without a worker. For ClownProlog Nr. 1

    I am refering to this here:

    Monaco Playground for Ciao Prolog
    Madrid, Junio 2022 - Guillermo Garcia Pradales https://oa.upm.es/71073/1/TFG_GUILLERMO_GARCIA_PRADALES.pdf

    Pitty they are so closed. The tutorial application
    mentioned in the PDF is nowhere seen. They are
    similarly close like when they published this here:

    Lightweight compilation of (C)LP to JavaScript https://arxiv.org/pdf/1210.2864.pdf

    It never made it into any Ciao distribution. Which is
    anyway now obsolete, since Ciao WASM is faster
    than Ciao JS. Ciao WASM is really brilliant!

    Mostowski Collapse schrieb am Donnerstag, 11. August 2022 um 14:52:58 UTC+2:
    Since priorities are different, it will clearly take weeks
    or months, for a demonstration. Also there are not
    much shoulders to climb, at least I didn't find

    a lot of precedents, and who wants to climb giant
    morons? ClownProlog Nr. 2 is even not asyncified, they
    even don't know what this is. ClownProlog Nr. 1 could

    be better off, they seem to have a haze idea.

    LoL
    Mostowski Collapse schrieb am Donnerstag, 11. August 2022 um 14:41:20 UTC+2:
    'When a clown moves into a palace, he doesn't
    become a king. The palace becomes a circus.'

    -Turkish proverb

    Now we have two ClownPrologs:

    ClownProlog Nr. 1: Ciao Prolog:
    This here looks like a Prolog terminal in the browser,
    but doesn't behave like a Prolog terminal: https://ciao-lang.org/playground/
    Try read/1 etc.. Its documented that this is a limitation.

    ClownProlog Nr. 2: SWI-Prolog:
    Maybe inspired by Ciao Prolog playground, that they made
    quickly a rip off? Its a little better off, one can abort a query. https://dev.swi-prolog.org/wasm/shell
    But try read/1 etc..

    My proposal for async ISO core standard I/O could
    adress this problem. But interestingly its also not top
    priority for Dogelog. I just figured out that I need other

    stuff first. But Dogelog does not try to present the illusion
    of a terminal, when it does not yet have a terminal. None
    of the examples try to provide such a illusion.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Thu Aug 11 08:27:35 2022
    Rust struggles with Async, from the Chalk blog

    Async cancellation: a case study of pub-sub in mini-redis https://smallcultfollowing.com/babysteps/blog/2022/06/13/async-cancellation-a-case-study-of-pub-sub-in-mini-redis/

    I wonder where he gets the nonsense from that
    JavaScript does create tasks for async functions,
    and that an async helper would even create a further

    Task. Sounds pretty much FUD to me, trying to defend some
    Rust alternative. Similar to the FUD that an asyncified WASM
    has overhead and unfavorable footprint.

    Thats just your humanly ape brain acceptance curve:
    - Resistance
    - Denial
    - Exploration
    - Commitment

    Where are you on this timeline?

    LMAO!

    Mostowski Collapse schrieb am Donnerstag, 11. August 2022 um 15:23:48 UTC+2:
    Why could be ClownProlog Nr. 1 better of.
    They have an async facade, at least their file
    says so ciao-async.js. Thats already a good

    start, although it has the unholy combination
    with a worker. ClownProlog Nr. 2 demonstrates
    a solution without a worker. For ClownProlog Nr. 1

    I am refering to this here:

    Monaco Playground for Ciao Prolog
    Madrid, Junio 2022 - Guillermo Garcia Pradales https://oa.upm.es/71073/1/TFG_GUILLERMO_GARCIA_PRADALES.pdf

    Pitty they are so closed. The tutorial application
    mentioned in the PDF is nowhere seen. They are
    similarly close like when they published this here:

    Lightweight compilation of (C)LP to JavaScript https://arxiv.org/pdf/1210.2864.pdf

    It never made it into any Ciao distribution. Which is
    anyway now obsolete, since Ciao WASM is faster
    than Ciao JS. Ciao WASM is really brilliant!
    Mostowski Collapse schrieb am Donnerstag, 11. August 2022 um 14:52:58 UTC+2:
    Since priorities are different, it will clearly take weeks
    or months, for a demonstration. Also there are not
    much shoulders to climb, at least I didn't find

    a lot of precedents, and who wants to climb giant
    morons? ClownProlog Nr. 2 is even not asyncified, they
    even don't know what this is. ClownProlog Nr. 1 could

    be better off, they seem to have a haze idea.

    LoL
    Mostowski Collapse schrieb am Donnerstag, 11. August 2022 um 14:41:20 UTC+2:
    'When a clown moves into a palace, he doesn't
    become a king. The palace becomes a circus.'

    -Turkish proverb

    Now we have two ClownPrologs:

    ClownProlog Nr. 1: Ciao Prolog:
    This here looks like a Prolog terminal in the browser,
    but doesn't behave like a Prolog terminal: https://ciao-lang.org/playground/
    Try read/1 etc.. Its documented that this is a limitation.

    ClownProlog Nr. 2: SWI-Prolog:
    Maybe inspired by Ciao Prolog playground, that they made
    quickly a rip off? Its a little better off, one can abort a query. https://dev.swi-prolog.org/wasm/shell
    But try read/1 etc..

    My proposal for async ISO core standard I/O could
    adress this problem. But interestingly its also not top
    priority for Dogelog. I just figured out that I need other

    stuff first. But Dogelog does not try to present the illusion
    of a terminal, when it does not yet have a terminal. None
    of the examples try to provide such a illusion.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Fri Aug 12 06:56:33 2022
    Try the text of a message: https://www.prolog.logtalk.org/viewtopic.php?f=5&t=24

    Empty, could be the bbcode.php error...

    Mostowski Collapse schrieb am Freitag, 12. August 2022 um 15:54:11 UTC+2:
    LoL, I guess somebody didn't update their servers:

    [phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead

    https://www.prolog.logtalk.org/ is producing nonsense now.
    Mostowski Collapse schrieb am Freitag, 12. August 2022 um 15:49:54 UTC+2:
    Anyway why ask for permission to write enhancement
    proposals (EPs), just write them? From the time of Paulo
    Moura there are the most EPs. Prolog threads/messages

    (October 28, 2008), Prolog global variables, what else? You
    see the focus of his endeavours here, everything stalled
    in the below forum in 2009, where did it go?

    - Core Revision
    - Definite Clause Grammars
    - Globals and Arrays
    - Multi-Threading
    - Portable Operating-System Interface
    - Unicode
    https://www.prolog.logtalk.org/

    What PEPs do you want to write? Did his focus match the
    requirements of Web Prolog. I do see missing:

    - Cooperative Multitasking
    - Foreign Functions Calls
    - Format and Protocolls
    - Prolog Corouting & Attributed Variables
    - What else?

    Cooperative Multitasking would cover issues that recently
    poped up in the WASM and non-WASM integration of
    Prolog system into a HTML page, similarly Foreign Functions

    Calls, like having a DOM event handler call Prolog, or manipulating
    DOM by Prolog. The Format and Protocolls item can mean HTTP,
    JSON, etc… The first 3 topics are somehow interconnected, so if you

    botch one of the 3 topics, the overall result is not so good.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to All on Fri Aug 12 06:49:53 2022
    Anyway why ask for permission to write enhancement
    proposals (EPs), just write them? From the time of Paulo
    Moura there are the most EPs. Prolog threads/messages

    (October 28, 2008), Prolog global variables, what else? You
    see the focus of his endeavours here, everything stalled
    in the below forum in 2009, where did it go?

    - Core Revision
    - Definite Clause Grammars
    - Globals and Arrays
    - Multi-Threading
    - Portable Operating-System Interface
    - Unicode
    https://www.prolog.logtalk.org/

    What PEPs do you want to write? Did his focus match the
    requirements of Web Prolog. I do see missing:

    - Cooperative Multitasking
    - Foreign Functions Calls
    - Format and Protocolls
    - Prolog Corouting & Attributed Variables
    - What else?

    Cooperative Multitasking would cover issues that recently
    poped up in the WASM and non-WASM integration of
    Prolog system into a HTML page, similarly Foreign Functions

    Calls, like having a DOM event handler call Prolog, or manipulating
    DOM by Prolog. The Format and Protocolls item can mean HTTP,
    JSON, etc… The first 3 topics are somehow interconnected, so if you

    botch one of the 3 topics, the overall result is not so good.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Fri Aug 12 06:54:09 2022
    LoL, I guess somebody didn't update their servers:

    [phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead

    https://www.prolog.logtalk.org/ is producing nonsense now.

    Mostowski Collapse schrieb am Freitag, 12. August 2022 um 15:49:54 UTC+2:
    Anyway why ask for permission to write enhancement
    proposals (EPs), just write them? From the time of Paulo
    Moura there are the most EPs. Prolog threads/messages

    (October 28, 2008), Prolog global variables, what else? You
    see the focus of his endeavours here, everything stalled
    in the below forum in 2009, where did it go?

    - Core Revision
    - Definite Clause Grammars
    - Globals and Arrays
    - Multi-Threading
    - Portable Operating-System Interface
    - Unicode
    https://www.prolog.logtalk.org/

    What PEPs do you want to write? Did his focus match the
    requirements of Web Prolog. I do see missing:

    - Cooperative Multitasking
    - Foreign Functions Calls
    - Format and Protocolls
    - Prolog Corouting & Attributed Variables
    - What else?

    Cooperative Multitasking would cover issues that recently
    poped up in the WASM and non-WASM integration of
    Prolog system into a HTML page, similarly Foreign Functions

    Calls, like having a DOM event handler call Prolog, or manipulating
    DOM by Prolog. The Format and Protocolls item can mean HTTP,
    JSON, etc… The first 3 topics are somehow interconnected, so if you

    botch one of the 3 topics, the overall result is not so good.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Sun Aug 14 01:48:19 2022
    Woa! Maybe make it priority a library(lists) standard?

    - Lists

    Poor LogNonsenseTalk had to implement everything on
    its own. Doesn't this lead to some code bloat? If you have
    a playground and WASM, you probably don't want this,

    everything twice going over the wire: https://github.com/LogtalkDotOrg/logtalk3/blob/master/library/types/list.lgt

    Mostowski Collapse schrieb am Freitag, 12. August 2022 um 15:49:54 UTC+2:
    Anyway why ask for permission to write enhancement
    proposals (EPs), just write them? From the time of Paulo
    Moura there are the most EPs. Prolog threads/messages

    (October 28, 2008), Prolog global variables, what else? You
    see the focus of his endeavours here, everything stalled
    in the below forum in 2009, where did it go?

    - Core Revision
    - Definite Clause Grammars
    - Globals and Arrays
    - Multi-Threading
    - Portable Operating-System Interface
    - Unicode
    https://www.prolog.logtalk.org/

    What PEPs do you want to write? Did his focus match the
    requirements of Web Prolog. I do see missing:

    - Cooperative Multitasking
    - Foreign Functions Calls
    - Format and Protocolls
    - Prolog Corouting & Attributed Variables
    - What else?

    Cooperative Multitasking would cover issues that recently
    poped up in the WASM and non-WASM integration of
    Prolog system into a HTML page, similarly Foreign Functions

    Calls, like having a DOM event handler call Prolog, or manipulating
    DOM by Prolog. The Format and Protocolls item can mean HTTP,
    JSON, etc… The first 3 topics are somehow interconnected, so if you

    botch one of the 3 topics, the overall result is not so good.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Sun Aug 14 07:37:34 2022
    Mostlikely there will never be a Lists PEP, since the
    Prolog systems are much to much ossified. A little chance
    might have some newcomers, like for example:

    - Tau Prolog
    - Scryer Prolog
    - Trealla Prolog
    - Dogelog Player
    - Ichiban Prolog
    - What else?

    But the old whales have possibly no chance to do something,
    would require too much refactoring. Because most likely lists and
    friends are used internally by the compiler and runtime.

    What would have a chance maybe, if there were forks especially
    for some playgrounds. Lets say such a fork were Ciao2. Then
    there would be maybe a chance if we would see:

    - Ciao2 Prolog
    - GNU2 Prolog
    - SICStus2 Prolog
    - What else?

    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 10:48:20 UTC+2:
    Woa! Maybe make it priority a library(lists) standard?

    - Lists

    Poor LogNonsenseTalk had to implement everything on
    its own. Doesn't this lead to some code bloat? If you have
    a playground and WASM, you probably don't want this,

    everything twice going over the wire: https://github.com/LogtalkDotOrg/logtalk3/blob/master/library/types/list.lgt

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Sun Aug 14 07:38:28 2022
    If I only pick substract/3 its already here:

    - YAP Prolog
    - ECLiPSe Prolog
    - What else?

    I cannot asses the YAP Prolog systems so easily. For example,
    there is maybe a pretty printing problem. I see strange stuff
    like this extra memberchk/0 and extra subtract/0:

    subtract([], _, []) :- subtract.
    subtract([E|T], D, R) :-
    memberchk(E, D), memberchk,
    subtract(T, D, R).
    subtract([H|T], D, [H|R]) :-
    subtract(T, D, R).
    https://www.dcc.fc.up.pt/~vsc/yap/lists_8yap_source.html

    Some broken pretty printer?

    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 16:37:35 UTC+2:
    Mostlikely there will never be a Lists PEP, since the
    Prolog systems are much to much ossified. A little chance
    might have some newcomers, like for example:

    - Tau Prolog
    - Scryer Prolog
    - Trealla Prolog
    - Dogelog Player
    - Ichiban Prolog
    - What else?

    But the old whales have possibly no chance to do something,
    would require too much refactoring. Because most likely lists and
    friends are used internally by the compiler and runtime.

    What would have a chance maybe, if there were forks especially
    for some playgrounds. Lets say such a fork were Ciao2. Then
    there would be maybe a chance if we would see:

    - Ciao2 Prolog
    - GNU2 Prolog
    - SICStus2 Prolog
    - What else?
    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 10:48:20 UTC+2:
    Woa! Maybe make it priority a library(lists) standard?

    - Lists

    Poor LogNonsenseTalk had to implement everything on
    its own. Doesn't this lead to some code bloat? If you have
    a playground and WASM, you probably don't want this,

    everything twice going over the wire: https://github.com/LogtalkDotOrg/logtalk3/blob/master/library/types/list.lgt

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Sun Aug 14 07:47:37 2022
    Unfortunately the test campaigns of Ulrich Neumerkel
    don't have much merit. On the other hand he recently
    raised a ticket about:

    ?- setof(t,(L=2;L=1),L).
    uncaught exception: error(type_error(list,1),sort/2), unexpected.

    slightly implying he wants not a type error? On the other
    hand his latest length/2 test cases, are like 75% type
    error and domain error tests of some output argument,

    which in my opinion can be easily dropped from a certain
    interpretation of the ISO core standard. It only causes
    slowdown of the Prolog system. Among the Prolog systems

    that pass these nonsense tests are also mostly Prolog
    systems that are not the fastest. See for yourself:

    https://www.complang.tuwien.ac.at/ulrich/iso-prolog/length

    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 16:39:40 UTC+2:
    Ulrich Neumerkel was invesitigating certain predicates in
    the past. Like for example here. This seems be a kind of
    updated, I see Ichiban Prolog column, must be newer:

    https://www.complang.tuwien.ac.at/ulrich/iso-prolog/length

    If you append .html,v, you see the versions of this file:

    1.23
    date 2022.07.16.13.24.22

    Whether somebody can jump into this role of Ulrich Neumerkel,
    especially from academia, I doubt. They don’t have time
    for that. They have other jobs to do. Maybe a better

    automatization would help. I wrote a new version of a test
    runner for Dogelog player. There are various test runners
    included in various Prolog systems. Even Logtalk has

    a test runner. For a continous integration / continous
    deployment pipeline, that would do a kind of PEP assesment
    across Prolog systems, that is visible together with the PEP,

    somesuch could be a useful tool.
    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 16:38:29 UTC+2:
    If I only pick substract/3 its already here:

    - YAP Prolog
    - ECLiPSe Prolog
    - What else?

    I cannot asses the YAP Prolog systems so easily. For example,
    there is maybe a pretty printing problem. I see strange stuff
    like this extra memberchk/0 and extra subtract/0:

    subtract([], _, []) :- subtract.
    subtract([E|T], D, R) :-
    memberchk(E, D), memberchk,
    subtract(T, D, R).
    subtract([H|T], D, [H|R]) :-
    subtract(T, D, R). https://www.dcc.fc.up.pt/~vsc/yap/lists_8yap_source.html

    Some broken pretty printer?
    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 16:37:35 UTC+2:
    Mostlikely there will never be a Lists PEP, since the
    Prolog systems are much to much ossified. A little chance
    might have some newcomers, like for example:

    - Tau Prolog
    - Scryer Prolog
    - Trealla Prolog
    - Dogelog Player
    - Ichiban Prolog
    - What else?

    But the old whales have possibly no chance to do something,
    would require too much refactoring. Because most likely lists and friends are used internally by the compiler and runtime.

    What would have a chance maybe, if there were forks especially
    for some playgrounds. Lets say such a fork were Ciao2. Then
    there would be maybe a chance if we would see:

    - Ciao2 Prolog
    - GNU2 Prolog
    - SICStus2 Prolog
    - What else?
    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 10:48:20 UTC+2:
    Woa! Maybe make it priority a library(lists) standard?

    - Lists

    Poor LogNonsenseTalk had to implement everything on
    its own. Doesn't this lead to some code bloat? If you have
    a playground and WASM, you probably don't want this,

    everything twice going over the wire: https://github.com/LogtalkDotOrg/logtalk3/blob/master/library/types/list.lgt

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Sun Aug 14 07:39:39 2022
    Ulrich Neumerkel was invesitigating certain predicates in
    the past. Like for example here. This seems be a kind of
    updated, I see Ichiban Prolog column, must be newer:

    https://www.complang.tuwien.ac.at/ulrich/iso-prolog/length

    If you append .html,v, you see the versions of this file:

    1.23
    date 2022.07.16.13.24.22

    Whether somebody can jump into this role of Ulrich Neumerkel,
    especially from academia, I doubt. They don’t have time
    for that. They have other jobs to do. Maybe a better

    automatization would help. I wrote a new version of a test
    runner for Dogelog player. There are various test runners
    included in various Prolog systems. Even Logtalk has

    a test runner. For a continous integration / continous
    deployment pipeline, that would do a kind of PEP assesment
    across Prolog systems, that is visible together with the PEP,

    somesuch could be a useful tool.

    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 16:38:29 UTC+2:
    If I only pick substract/3 its already here:

    - YAP Prolog
    - ECLiPSe Prolog
    - What else?

    I cannot asses the YAP Prolog systems so easily. For example,
    there is maybe a pretty printing problem. I see strange stuff
    like this extra memberchk/0 and extra subtract/0:

    subtract([], _, []) :- subtract.
    subtract([E|T], D, R) :-
    memberchk(E, D), memberchk,
    subtract(T, D, R).
    subtract([H|T], D, [H|R]) :-
    subtract(T, D, R).
    https://www.dcc.fc.up.pt/~vsc/yap/lists_8yap_source.html

    Some broken pretty printer?
    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 16:37:35 UTC+2:
    Mostlikely there will never be a Lists PEP, since the
    Prolog systems are much to much ossified. A little chance
    might have some newcomers, like for example:

    - Tau Prolog
    - Scryer Prolog
    - Trealla Prolog
    - Dogelog Player
    - Ichiban Prolog
    - What else?

    But the old whales have possibly no chance to do something,
    would require too much refactoring. Because most likely lists and
    friends are used internally by the compiler and runtime.

    What would have a chance maybe, if there were forks especially
    for some playgrounds. Lets say such a fork were Ciao2. Then
    there would be maybe a chance if we would see:

    - Ciao2 Prolog
    - GNU2 Prolog
    - SICStus2 Prolog
    - What else?
    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 10:48:20 UTC+2:
    Woa! Maybe make it priority a library(lists) standard?

    - Lists

    Poor LogNonsenseTalk had to implement everything on
    its own. Doesn't this lead to some code bloat? If you have
    a playground and WASM, you probably don't want this,

    everything twice going over the wire: https://github.com/LogtalkDotOrg/logtalk3/blob/master/library/types/list.lgt

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Sun Aug 14 08:12:40 2022
    Also tests such as:
    ```
    ?- length([a|b], X).
    ERROR: Type error: `list' expected, found `[a|b]' (a compound)
    ```
    Are totally missing in the assesment page by Ulrich Neumerkel.
    So what is the coverage?

    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 16:59:33 UTC+2:
    In length/2 its easy to nevertheless support these errors,
    since one can use a var/1 test in the second argument instead
    of a ground/1 test in the first argument, when deciding the mode.

    In as far I can offer this behaviour:

    ?- length([a,b,c],x).
    error(type_error(integer, x), [user:1])
    ?- length([a,b,c],-1).
    fail.
    ?- length(X,-1).
    fail.

    Isn’t the fail nice?

    The fail is not on the agenda of Ulrich Neumerkel.
    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 16:47:39 UTC+2:
    Unfortunately the test campaigns of Ulrich Neumerkel
    don't have much merit. On the other hand he recently
    raised a ticket about:

    ?- setof(t,(L=2;L=1),L).
    uncaught exception: error(type_error(list,1),sort/2), unexpected.

    slightly implying he wants not a type error? On the other
    hand his latest length/2 test cases, are like 75% type
    error and domain error tests of some output argument,

    which in my opinion can be easily dropped from a certain
    interpretation of the ISO core standard. It only causes
    slowdown of the Prolog system. Among the Prolog systems

    that pass these nonsense tests are also mostly Prolog
    systems that are not the fastest. See for yourself:

    https://www.complang.tuwien.ac.at/ulrich/iso-prolog/length
    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 16:39:40 UTC+2:
    Ulrich Neumerkel was invesitigating certain predicates in
    the past. Like for example here. This seems be a kind of
    updated, I see Ichiban Prolog column, must be newer:

    https://www.complang.tuwien.ac.at/ulrich/iso-prolog/length

    If you append .html,v, you see the versions of this file:

    1.23
    date 2022.07.16.13.24.22

    Whether somebody can jump into this role of Ulrich Neumerkel,
    especially from academia, I doubt. They don’t have time
    for that. They have other jobs to do. Maybe a better

    automatization would help. I wrote a new version of a test
    runner for Dogelog player. There are various test runners
    included in various Prolog systems. Even Logtalk has

    a test runner. For a continous integration / continous
    deployment pipeline, that would do a kind of PEP assesment
    across Prolog systems, that is visible together with the PEP,

    somesuch could be a useful tool.
    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 16:38:29 UTC+2:
    If I only pick substract/3 its already here:

    - YAP Prolog
    - ECLiPSe Prolog
    - What else?

    I cannot asses the YAP Prolog systems so easily. For example,
    there is maybe a pretty printing problem. I see strange stuff
    like this extra memberchk/0 and extra subtract/0:

    subtract([], _, []) :- subtract.
    subtract([E|T], D, R) :-
    memberchk(E, D), memberchk,
    subtract(T, D, R).
    subtract([H|T], D, [H|R]) :-
    subtract(T, D, R). https://www.dcc.fc.up.pt/~vsc/yap/lists_8yap_source.html

    Some broken pretty printer?
    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 16:37:35 UTC+2:
    Mostlikely there will never be a Lists PEP, since the
    Prolog systems are much to much ossified. A little chance
    might have some newcomers, like for example:

    - Tau Prolog
    - Scryer Prolog
    - Trealla Prolog
    - Dogelog Player
    - Ichiban Prolog
    - What else?

    But the old whales have possibly no chance to do something,
    would require too much refactoring. Because most likely lists and friends are used internally by the compiler and runtime.

    What would have a chance maybe, if there were forks especially
    for some playgrounds. Lets say such a fork were Ciao2. Then
    there would be maybe a chance if we would see:

    - Ciao2 Prolog
    - GNU2 Prolog
    - SICStus2 Prolog
    - What else?
    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 10:48:20 UTC+2:
    Woa! Maybe make it priority a library(lists) standard?

    - Lists

    Poor LogNonsenseTalk had to implement everything on
    its own. Doesn't this lead to some code bloat? If you have
    a playground and WASM, you probably don't want this,

    everything twice going over the wire: https://github.com/LogtalkDotOrg/logtalk3/blob/master/library/types/list.lgt

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Sun Aug 14 07:59:31 2022
    In length/2 its easy to nevertheless support these errors,
    since one can use a var/1 test in the second argument instead
    of a ground/1 test in the first argument, when deciding the mode.

    In as far I can offer this behaviour:

    ?- length([a,b,c],x).
    error(type_error(integer, x), [user:1])
    ?- length([a,b,c],-1).
    fail.
    ?- length(X,-1).
    fail.

    Isn’t the fail nice?

    The fail is not on the agenda of Ulrich Neumerkel.

    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 16:47:39 UTC+2:
    Unfortunately the test campaigns of Ulrich Neumerkel
    don't have much merit. On the other hand he recently
    raised a ticket about:

    ?- setof(t,(L=2;L=1),L).
    uncaught exception: error(type_error(list,1),sort/2), unexpected.

    slightly implying he wants not a type error? On the other
    hand his latest length/2 test cases, are like 75% type
    error and domain error tests of some output argument,

    which in my opinion can be easily dropped from a certain
    interpretation of the ISO core standard. It only causes
    slowdown of the Prolog system. Among the Prolog systems

    that pass these nonsense tests are also mostly Prolog
    systems that are not the fastest. See for yourself:

    https://www.complang.tuwien.ac.at/ulrich/iso-prolog/length
    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 16:39:40 UTC+2:
    Ulrich Neumerkel was invesitigating certain predicates in
    the past. Like for example here. This seems be a kind of
    updated, I see Ichiban Prolog column, must be newer:

    https://www.complang.tuwien.ac.at/ulrich/iso-prolog/length

    If you append .html,v, you see the versions of this file:

    1.23
    date 2022.07.16.13.24.22

    Whether somebody can jump into this role of Ulrich Neumerkel,
    especially from academia, I doubt. They don’t have time
    for that. They have other jobs to do. Maybe a better

    automatization would help. I wrote a new version of a test
    runner for Dogelog player. There are various test runners
    included in various Prolog systems. Even Logtalk has

    a test runner. For a continous integration / continous
    deployment pipeline, that would do a kind of PEP assesment
    across Prolog systems, that is visible together with the PEP,

    somesuch could be a useful tool.
    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 16:38:29 UTC+2:
    If I only pick substract/3 its already here:

    - YAP Prolog
    - ECLiPSe Prolog
    - What else?

    I cannot asses the YAP Prolog systems so easily. For example,
    there is maybe a pretty printing problem. I see strange stuff
    like this extra memberchk/0 and extra subtract/0:

    subtract([], _, []) :- subtract.
    subtract([E|T], D, R) :-
    memberchk(E, D), memberchk,
    subtract(T, D, R).
    subtract([H|T], D, [H|R]) :-
    subtract(T, D, R). https://www.dcc.fc.up.pt/~vsc/yap/lists_8yap_source.html

    Some broken pretty printer?
    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 16:37:35 UTC+2:
    Mostlikely there will never be a Lists PEP, since the
    Prolog systems are much to much ossified. A little chance
    might have some newcomers, like for example:

    - Tau Prolog
    - Scryer Prolog
    - Trealla Prolog
    - Dogelog Player
    - Ichiban Prolog
    - What else?

    But the old whales have possibly no chance to do something,
    would require too much refactoring. Because most likely lists and friends are used internally by the compiler and runtime.

    What would have a chance maybe, if there were forks especially
    for some playgrounds. Lets say such a fork were Ciao2. Then
    there would be maybe a chance if we would see:

    - Ciao2 Prolog
    - GNU2 Prolog
    - SICStus2 Prolog
    - What else?
    Mostowski Collapse schrieb am Sonntag, 14. August 2022 um 10:48:20 UTC+2:
    Woa! Maybe make it priority a library(lists) standard?

    - Lists

    Poor LogNonsenseTalk had to implement everything on
    its own. Doesn't this lead to some code bloat? If you have
    a playground and WASM, you probably don't want this,

    everything twice going over the wire: https://github.com/LogtalkDotOrg/logtalk3/blob/master/library/types/list.lgt

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Sat Aug 20 04:41:54 2022
    Maybe a good start for Cooperative Multitasking would
    be an engine API? Or a delimited continuation API?

    Delimited continuation is sometimes favored to make
    stare transformers. Here is a little benchmark from SWI-Prolog:

    /* shift/1, warm run */
    ?- time(run_state(fib(28), 0, S)).
    % 9,770,334 inferences, 2.437 CPU in 2.861 seconds (85% CPU, 4008342 Lips)
    S = 514229 .

    /* engine_yield/1, warm run */
    ?- time(run_state(fib(28), 0, S)).
    % 3,599,612 inferences, 1.109 CPU in 1.177 seconds (94% CPU, 3244721 Lips)
    S = 514229 .

    Woa! engine_yield/1 was more than twice as fast as shift/1! Was using this fibonacci with spurious choice points, as often found in pure DCG:

    fib(0) :- inc(1).
    fib(1) :- inc(1).
    fib(N) :- N > 1, M is N-1, fib(M), J is M-1, fib(J).

    Mostowski Collapse schrieb am Freitag, 12. August 2022 um 15:49:54 UTC+2:
    Anyway why ask for permission to write enhancement
    proposals (EPs), just write them? From the time of Paulo
    Moura there are the most EPs. Prolog threads/messages

    (October 28, 2008), Prolog global variables, what else? You
    see the focus of his endeavours here, everything stalled
    in the below forum in 2009, where did it go?

    - Core Revision
    - Definite Clause Grammars
    - Globals and Arrays
    - Multi-Threading
    - Portable Operating-System Interface
    - Unicode
    https://www.prolog.logtalk.org/

    What PEPs do you want to write? Did his focus match the
    requirements of Web Prolog. I do see missing:

    - Cooperative Multitasking
    - Foreign Functions Calls
    - Format and Protocolls
    - Prolog Corouting & Attributed Variables
    - What else?

    Cooperative Multitasking would cover issues that recently
    poped up in the WASM and non-WASM integration of
    Prolog system into a HTML page, similarly Foreign Functions

    Calls, like having a DOM event handler call Prolog, or manipulating
    DOM by Prolog. The Format and Protocolls item can mean HTTP,
    JSON, etc… The first 3 topics are somehow interconnected, so if you

    botch one of the 3 topics, the overall result is not so good.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Sat Aug 20 04:42:59 2022
    Maybe an interesting experiment would be, whether SLG Tabling
    can be implemented with engine_yield/1 instead of shift/1?

    Mostowski Collapse schrieb am Samstag, 20. August 2022 um 13:41:56 UTC+2:
    Maybe a good start for Cooperative Multitasking would
    be an engine API? Or a delimited continuation API?

    Delimited continuation is sometimes favored to make
    stare transformers. Here is a little benchmark from SWI-Prolog:

    /* shift/1, warm run */
    ?- time(run_state(fib(28), 0, S)).
    % 9,770,334 inferences, 2.437 CPU in 2.861 seconds (85% CPU, 4008342 Lips)
    S = 514229 .

    /* engine_yield/1, warm run */
    ?- time(run_state(fib(28), 0, S)).
    % 3,599,612 inferences, 1.109 CPU in 1.177 seconds (94% CPU, 3244721 Lips)
    S = 514229 .

    Woa! engine_yield/1 was more than twice as fast as shift/1! Was using this fibonacci with spurious choice points, as often found in pure DCG:

    fib(0) :- inc(1).
    fib(1) :- inc(1).
    fib(N) :- N > 1, M is N-1, fib(M), J is M-1, fib(J).
    Mostowski Collapse schrieb am Freitag, 12. August 2022 um 15:49:54 UTC+2:
    Anyway why ask for permission to write enhancement
    proposals (EPs), just write them? From the time of Paulo
    Moura there are the most EPs. Prolog threads/messages

    (October 28, 2008), Prolog global variables, what else? You
    see the focus of his endeavours here, everything stalled
    in the below forum in 2009, where did it go?

    - Core Revision
    - Definite Clause Grammars
    - Globals and Arrays
    - Multi-Threading
    - Portable Operating-System Interface
    - Unicode
    https://www.prolog.logtalk.org/

    What PEPs do you want to write? Did his focus match the
    requirements of Web Prolog. I do see missing:

    - Cooperative Multitasking
    - Foreign Functions Calls
    - Format and Protocolls
    - Prolog Corouting & Attributed Variables
    - What else?

    Cooperative Multitasking would cover issues that recently
    poped up in the WASM and non-WASM integration of
    Prolog system into a HTML page, similarly Foreign Functions

    Calls, like having a DOM event handler call Prolog, or manipulating
    DOM by Prolog. The Format and Protocolls item can mean HTTP,
    JSON, etc… The first 3 topics are somehow interconnected, so if you

    botch one of the 3 topics, the overall result is not so good.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Sat Aug 20 11:25:59 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Sat Aug 20 11:22:37 2022
    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

    Mostowski Collapse schrieb am Samstag, 20. August 2022 um 13:43:01 UTC+2:
    Maybe an interesting experiment would be, whether SLG Tabling
    can be implemented with engine_yield/1 instead of shift/1?
    Mostowski Collapse schrieb am Samstag, 20. August 2022 um 13:41:56 UTC+2:
    Maybe a good start for Cooperative Multitasking would
    be an engine API? Or a delimited continuation API?

    Delimited continuation is sometimes favored to make
    stare transformers. Here is a little benchmark from SWI-Prolog:

    /* shift/1, warm run */
    ?- time(run_state(fib(28), 0, S)).
    % 9,770,334 inferences, 2.437 CPU in 2.861 seconds (85% CPU, 4008342 Lips) S = 514229 .

    /* engine_yield/1, warm run */
    ?- time(run_state(fib(28), 0, S)).
    % 3,599,612 inferences, 1.109 CPU in 1.177 seconds (94% CPU, 3244721 Lips) S = 514229 .

    Woa! engine_yield/1 was more than twice as fast as shift/1! Was using this fibonacci with spurious choice points, as often found in pure DCG:

    fib(0) :- inc(1).
    fib(1) :- inc(1).
    fib(N) :- N > 1, M is N-1, fib(M), J is M-1, fib(J).
    Mostowski Collapse schrieb am Freitag, 12. August 2022 um 15:49:54 UTC+2:
    Anyway why ask for permission to write enhancement
    proposals (EPs), just write them? From the time of Paulo
    Moura there are the most EPs. Prolog threads/messages

    (October 28, 2008), Prolog global variables, what else? You
    see the focus of his endeavours here, everything stalled
    in the below forum in 2009, where did it go?

    - Core Revision
    - Definite Clause Grammars
    - Globals and Arrays
    - Multi-Threading
    - Portable Operating-System Interface
    - Unicode
    https://www.prolog.logtalk.org/

    What PEPs do you want to write? Did his focus match the
    requirements of Web Prolog. I do see missing:

    - Cooperative Multitasking
    - Foreign Functions Calls
    - Format and Protocolls
    - Prolog Corouting & Attributed Variables
    - What else?

    Cooperative Multitasking would cover issues that recently
    poped up in the WASM and non-WASM integration of
    Prolog system into a HTML page, similarly Foreign Functions

    Calls, like having a DOM event handler call Prolog, or manipulating
    DOM by Prolog. The Format and Protocolls item can mean HTTP,
    JSON, etc… The first 3 topics are somehow interconnected, so if you

    botch one of the 3 topics, the overall result is not so good.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Sun Aug 21 00:57:44 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Mon Aug 22 19:31:29 2022
    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] .

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to All on Mon Aug 22 19:30:05 2022
    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] .

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Wed Aug 24 06:08:38 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Wed Aug 24 06:10:48 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to All on Wed Aug 24 06:38:14 2022
    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?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Wed Aug 24 11:02:23 2022
    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([]).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Wed Aug 24 11:01:14 2022
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Wed Aug 24 12:18:48 2022
    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?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to All on Sun Sep 4 14:19:58 2022
    These are some ultra cute graphics!

    Cooperative Multitasking Visualized - Tau Prolog, 2022 http://tau-prolog.org/files/prole2022/#/4/4

    Noice!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to All on Thu Sep 15 14:09:59 2022
    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!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Fri Sep 16 02:54:39 2022
    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!


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Thu Oct 6 12:46:49 2022
    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!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to All on Thu Oct 6 12:43:04 2022
    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!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Thu Oct 6 12:48:46 2022
    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!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to Mostowski Collapse on Thu Mar 9 08:53:19 2023
    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/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mostowski Collapse@21:1/5 to All on Thu Mar 9 08:47:03 2023
    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/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Thu Feb 22 11:26:34 2024
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to All on Thu Feb 22 11:18:20 2024
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mostowski Collapse on Tue Mar 5 15:08:31 2024
    Ha Ha, now Scyer Prolog wants also
    byte friendly compact strings:

    2. introduce a compact internal representation for lists of bytes,
    which appear to Prolog programs as lists of characters. https://github.com/mthom/scryer-prolog/blob/master/src/lib/crypto.pl#L867C2-L868C63

    But they motivated it by security concerns,
    whereas my concern was to get rid of ISO-ism
    making a distinction between text and byte streams,

    on the Prolog API levels. It would be all codes.

    Mostowski Collapse schrieb:
    - UTF-16 native strings: Does work well with the envisioned
    "latin1" payload, the range 0..255 is encoded in one 16-bit word,
    which is two bytes, but most programming language already
    implement clever strings:

    JEP 254: Compact Strings
    We propose to change the internal representation of the String class
    from a UTF-16 char array to a byte array plus an encoding-flag field.
    The new String class will store characters encoded either as ISO-8859-1/ Latin-1 (one byte per character), or as UTF-16 (two bytes per character), based upon the contents of the string. The encoding flag will indicate
    which encoding is used.
    https://openjdk.org/jeps/254

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to All on Sat Mar 16 01:29:02 2024
    Now I have rewritten the Tic-Tac-Toe example
    to be 100% Prolog. Originally the Tic-Tac-Toe example
    was conceived as a first stab in exploring the

    foreign function interface (FFI) of Dogelog Player
    inside the browser to register JavaScript functions
    that do all kind of stuff with the DOM and events.

    But now I have library(markup) for DOM generation
    and library(react) for events. So I rewrote Tic-Tac-Toe
    using these utilities, reducing the amount of

    JavaScript logic to zero. Tic-Tac-Toe is now 100% Prolog.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Sat Mar 16 01:39:50 2024
    What also went down the drain abusing consult_async()
    to do the game intialization, instead I am now using
    perform_async(). So the code went from dangerous.

    await consult_async(":- ensure_loaded('browser.p').");

    dangerous because of possible file name quoting issues.
    To this where the file name is a string object and doesn't
    need to be Prolog encoded, because we don't invoke a Prolog

    text encoded query but a Prolog term:

    await perform_async(new Compound("ensure_loaded", ["browser.p"]));

    In has far we should make some Hydration experiment.
    What is Hydration. Its a new buzzword around the partially
    obsolete design, to have first the HTML body in a broswer

    doument and then at the end of the HTML body some scripts:

    r/webdev - What is Hydration? https://www.reddit.com/r/webdev/comments/xqd4i8/what_is_hydration/

    The bundle end of HTML body design has usually takes
    time time(html)+time(bundle). A better deisgn is unsing
    async loading and the quasi-parallelism of the browser,

    and load the bundle in the head if possible. The load time
    is then around max(time(bundle), time(html))). which might
    give better user experience. We should try the same

    for our examples, load Dogelog Player in the head. But
    the Prolog text loader is not yet task safe. So this might
    involve some more work until we can try it.

    Also we might nevertheless want to do a little hydration
    when the HTML body is read, like wiring event handlers.

    Mild Shock schrieb:
    Now I have rewritten the Tic-Tac-Toe example
    to be 100% Prolog. Originally the Tic-Tac-Toe example
    was conceived as a first stab in exploring the

    foreign function interface (FFI) of Dogelog Player
    inside the browser to register JavaScript functions
    that do all kind of stuff with the DOM and events.

    But now I have library(markup) for DOM generation
    and library(react) for events. So I rewrote Tic-Tac-Toe
    using these utilities, reducing the amount of

    JavaScript logic to zero. Tic-Tac-Toe is now 100% Prolog.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Sat Mar 16 01:48:44 2024
    Note because of the await in front of the
    perform_async() our loading doesn't create a task yet.
    It will change the current load sequence. It will

    only allow that tasks create before the await get
    their share of work. We would need to add one of our
    create_task utilities, or use the async option of a

    script tag, as recommened here for MathJax v3:

    /* put this in the head */
    <script type="text/javascript" id="MathJax-script" async
    src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js">
    </script>

    The async option of a script tag is described as:

    "For module scripts, if the async attribute is
    present then the scripts and all their dependencies
    will be fetched in parallel to parsing and evaluated
    as soon as they are available." https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#async

    Mild Shock schrieb:

    What also went down the drain abusing consult_async()
    to do the game intialization, instead I am now using
    perform_async(). So the code went from dangerous.

        await consult_async(":- ensure_loaded('browser.p').");

    dangerous because of possible file name quoting issues.
    To this where the file name is a string object and doesn't
    need to be Prolog encoded, because we don't invoke a Prolog

    text encoded query but a Prolog term:

        await perform_async(new Compound("ensure_loaded", ["browser.p"]));

    In has far we should make some Hydration experiment.
    What is Hydration. Its a new buzzword around the partially
    obsolete design, to have first the HTML body in a broswer

    doument and then at the end of the HTML body some scripts:

    r/webdev - What is Hydration? https://www.reddit.com/r/webdev/comments/xqd4i8/what_is_hydration/

    The bundle end of HTML body design has usually takes
    time time(html)+time(bundle). A better deisgn is unsing
    async loading and the quasi-parallelism of the browser,

    and load the bundle in the head if possible. The load time
    is then around max(time(bundle), time(html))). which might
    give better user experience. We should try the same

    for our examples, load Dogelog Player in the head. But
    the Prolog text loader is not yet task safe. So this might
    involve some more work until we can try it.

    Also we might nevertheless want to do a little hydration
    when the HTML body is read, like wiring event handlers.

    Mild Shock schrieb:
    Now I have rewritten the Tic-Tac-Toe example
    to be 100% Prolog. Originally the Tic-Tac-Toe example
    was conceived as a first stab in exploring the

    foreign function interface (FFI) of Dogelog Player
    inside the browser to register JavaScript functions
    that do all kind of stuff with the DOM and events.

    But now I have library(markup) for DOM generation
    and library(react) for events. So I rewrote Tic-Tac-Toe
    using these utilities, reducing the amount of

    JavaScript logic to zero. Tic-Tac-Toe is now 100% Prolog.


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mild Shock@21:1/5 to Mild Shock on Sat Mar 16 01:53:08 2024
    Corr. Typo

    It will NOT change the current load sequence.

    Mild Shock schrieb:

    Note because of the await in front of the
    perform_async() our loading doesn't create a task yet.
    It will change the current load sequence. It will

    only allow that tasks create before the await get
    their share of work. We would need to add one of our
    create_task utilities, or use the async option of a

    script tag, as recommened here for MathJax v3:

    /* put this in the head */
    <script type="text/javascript" id="MathJax-script" async
      src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js">
    </script>

    The async option of a script tag is described as:

    "For module scripts, if the async attribute is
    present then the scripts and all their dependencies
    will be fetched in parallel to parsing and evaluated
    as soon as they are available." https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#async

    Mild Shock schrieb:

    What also went down the drain abusing consult_async()
    to do the game intialization, instead I am now using
    perform_async(). So the code went from dangerous.

         await consult_async(":- ensure_loaded('browser.p').");

    dangerous because of possible file name quoting issues.
    To this where the file name is a string object and doesn't
    need to be Prolog encoded, because we don't invoke a Prolog

    text encoded query but a Prolog term:

         await perform_async(new Compound("ensure_loaded", ["browser.p"])); >>
    In has far we should make some Hydration experiment.
    What is Hydration. Its a new buzzword around the partially
    obsolete design, to have first the HTML body in a broswer

    doument and then at the end of the HTML body some scripts:

    r/webdev - What is Hydration?
    https://www.reddit.com/r/webdev/comments/xqd4i8/what_is_hydration/

    The bundle end of HTML body design has usually takes
    time time(html)+time(bundle). A better deisgn is unsing
    async loading and the quasi-parallelism of the browser,

    and load the bundle in the head if possible. The load time
    is then around max(time(bundle), time(html))). which might
    give better user experience. We should try the same

    for our examples, load Dogelog Player in the head. But
    the Prolog text loader is not yet task safe. So this might
    involve some more work until we can try it.

    Also we might nevertheless want to do a little hydration
    when the HTML body is read, like wiring event handlers.

    Mild Shock schrieb:
    Now I have rewritten the Tic-Tac-Toe example
    to be 100% Prolog. Originally the Tic-Tac-Toe example
    was conceived as a first stab in exploring the

    foreign function interface (FFI) of Dogelog Player
    inside the browser to register JavaScript functions
    that do all kind of stuff with the DOM and events.

    But now I have library(markup) for DOM generation
    and library(react) for events. So I rewrote Tic-Tac-Toe
    using these utilities, reducing the amount of

    JavaScript logic to zero. Tic-Tac-Toe is now 100% Prolog.



    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)