• Float enhancements stalled? (Was: VIP0909: VibeCore Improvement Proposal [term_singletons])

    From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Sun Mar 22 17:20:58 2026
    From Newsgroup: comp.lang.prolog

    Hi,

    Somehow this link is broken ( Not Found ):

    *0106.0 Float enhancements Draft* https://prolog-lang.org/ImprovementsForum/0106-floats-enhancements.html

    Also there is no consensus between ECLiPSe and SWI in realization:
    ```
    /* Version 7.1beta #13 (x86_64_nt) */
    [eclipse 5]: X is min(1.5NaN, 3).
    X = 3.0
    Yes (0.00s cpu)
    [eclipse 6]: X is min(3, 1.5NaN).
    X = 1.5NaN
    Yes (0.00s cpu)

    /* SWI-Prolog (threaded, 64 bits, version 10.1.1) */
    ?- X is min(1.5NaN, 3).
    X = 1.5NaN.
    ?- X is min(3, 1.5NaN).
    X = 1.5NaN.
    ```
    Mostlikely SWI uses IEEE minimum. While ECLiPSe uses (a < b ? a : b).

    Bye

    P.S.: I am planning a kind of IEEE minNum behaviour:
    ```
    /* Dogelog Player 2.2.1 */
    ?- X is min(0rNaN, 3).
    X = 3.
    ?- X is min(3, 0rNaN).
    X = 3.
    ```
    Note that there is no coercion of 3 into 3.0.


    Mild Shock schrieb:
    Hi,

    Functional requirement:

    ?- Y = g(_,_), X = f(Y,C,D,Y), term_singletons(X, L),
    -a-a L == [C,D].

    ?- Y = g(A,X,B), X = f(Y,C,D), term_singletons(X, L),
    -a-a L == [A,B,C,D].

    Non-Functional requirement:

    ?- member(N,[5,10,15]), time(singletons(N)), fail; true.
    % Zeit 1 ms, GC 0 ms, Lips 4046000, Uhr 11.08.2025 01:36
    % Zeit 3 ms, GC 0 ms, Lips 1352000, Uhr 11.08.2025 01:36
    % Zeit 3 ms, GC 0 ms, Lips 1355333, Uhr 11.08.2025 01:36
    true.

    Can your Prolog system do that?

    P.S.: Benchmark was:

    singletons(N) :-
    -a-a hydra2(N,Y),
    -a-a between(1,1000,_), term_singletons(Y,_), fail; true.

    hydra2(0, _) :- !.
    hydra2(N, s(X,X)) :-
    -a-a M is N-1,
    -a-a hydra2(M, X).

    Bye

    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Tue Mar 24 08:35:51 2026
    From Newsgroup: comp.lang.prolog

    minimumNumber/maximumNumber which do propagate NaN.

    Actually the suffix rCLNumberrCY in the name indicate
    that they donrCOt propagate NaN unless both arguments
    are NaN, the ones that propagate NaN are still
    rCLminimumrCY and rCLmaximumrCY without rCLNumberrCY suffix.

    See IEEE754_ver2019.pdf, you can choose at least between:

    9.6 Minimum and maximum operations
    sourceFormat minimum(source, source)
    sourceFormat minimumNumber(source, source)
    sourceFormat maximum(source, source)
    sourceFormat maximumNumber(source, source)

    I have tried to track my design choice so far and got:

    The built-in (=\=)/2 now implements
    not quiet IEEE 754-2019 -o5.6.1.
    The built-ins (=:=)/2, (<)/2, etc. now implement
    quiet IEEE 754-2019 -o5.6.1.
    The built-ins (@<)/2, etc. now implement
    quiet ordered IEEE 754-2019 -o5.6.1.
    The built-in (-)/2 now implements
    NaN propagation IEEE 754-2019 -o6.2.3.
    The built-ins min/3 and max/3 now implement
    number IEEE 754-2019 -o9.6.

    I didnrCOt touch arithmetic functions or trigonometric
    functions yet, they still bark on special values.
    Only tried to have a clean cut solution for ordering
    releated stuff, that uses special values, which

    has less coverage in the ECLiPSe document, and
    albeit arbitrary choices were made, some choices
    are inspired by what is found in other languages
    such as JavaScript, Python and Java, other choices are

    inspired to have a natural order,
    disagreeing with SWI and ECLiPSe:

    /* Version 7.1beta #13 (x86_64_nt) */
    [eclipse 1]: ?- sort([0, 0.0, 1.5NaN, -1.0Inf, 1.0Inf], X).
    X = [1.5NaN, -1.0Inf, 0.0, 1.0Inf, 0]

    /* SWI-Prolog (threaded, 64 bits, version 10.1.1) */
    ?- sort([0, 0.0, 1.5NaN, -1.0Inf, 1.0Inf], X).
    X = [1.5NaN, -1.0Inf, 0.0, 0, 1.0Inf].

    /* Dogelog Player 2.2.1 */
    ?- sort([0, 0.0, 0rNaN, -0rInf, 0rInf], X).
    X = [-0rInf, 0.0, 0, 0rInf, 0rNaN].

    One can still see ISO core standard typical things,
    like 0 \\== 0.0. That NaN is bigger than 0.0 in total
    order comes from IEEE 754-2019 -o5.6.1. SWI Prolog adopts
    finite float and integer ordered together surrounded

    by special values, while ECLiPSe Prolog does not do that.

    Mild Shock schrieb:
    Hi,

    Somehow this link is broken ( Not Found ):

    *0106.0 Float enhancements Draft* https://prolog-lang.org/ImprovementsForum/0106-floats-enhancements.html

    Also there is no consensus between ECLiPSe and SWI in realization:
    ```
    /* Version 7.1beta #13 (x86_64_nt) */
    [eclipse 5]: X is min(1.5NaN, 3).
    X = 3.0
    Yes (0.00s cpu)
    [eclipse 6]: X is min(3, 1.5NaN).
    X = 1.5NaN
    Yes (0.00s cpu)

    /* SWI-Prolog (threaded, 64 bits, version 10.1.1) */
    ?- X is min(1.5NaN, 3).
    X = 1.5NaN.
    ?- X is min(3, 1.5NaN).
    X = 1.5NaN.
    ```
    Mostlikely SWI uses IEEE minimum. While ECLiPSe uses (a < b ? a : b).

    Bye

    P.S.: I am planning a kind of IEEE minNum behaviour:
    ```
    /* Dogelog Player 2.2.1 */
    ?- X is min(0rNaN, 3).
    X = 3.
    ?- X is min(3, 0rNaN).
    X = 3.
    ```
    Note that there is no coercion of 3 into 3.0.


    Mild Shock schrieb:
    Hi,

    Functional requirement:

    ?- Y = g(_,_), X = f(Y,C,D,Y), term_singletons(X, L),
    -a-a-a L == [C,D].

    ?- Y = g(A,X,B), X = f(Y,C,D), term_singletons(X, L),
    -a-a-a L == [A,B,C,D].

    Non-Functional requirement:

    ?- member(N,[5,10,15]), time(singletons(N)), fail; true.
    % Zeit 1 ms, GC 0 ms, Lips 4046000, Uhr 11.08.2025 01:36
    % Zeit 3 ms, GC 0 ms, Lips 1352000, Uhr 11.08.2025 01:36
    % Zeit 3 ms, GC 0 ms, Lips 1355333, Uhr 11.08.2025 01:36
    true.

    Can your Prolog system do that?

    P.S.: Benchmark was:

    singletons(N) :-
    -a-a-a hydra2(N,Y),
    -a-a-a between(1,1000,_), term_singletons(Y,_), fail; true.

    hydra2(0, _) :- !.
    hydra2(N, s(X,X)) :-
    -a-a-a M is N-1,
    -a-a-a hydra2(M, X).

    Bye


    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Thu Aug 13 16:36:35 2026
    From Newsgroup: comp.lang.prolog

    Hi,

    Somehow I didnrCOt find any PIP yet for Intern-
    ationalization. I think SWI prolog has a messaging
    infrastructure, which can also generated messages
    in different languages. Probably inspired or
    inherited by Quintus Prolog.

    I did once some research and somehow saw something
    similar in Quintus Prolog. It also inspired Pillow,
    a web library, where output was seen as producing a
    message. Recently it occured to me more and more
    that it would be usefull to have multiple

    languages bundled into a single app.

    Internationalization and Localization
    The idea is often abbreviated to i18n (where
    18 stands for the number of letters between
    the first i and the last n in the word
    internationalization, a usage coined at Digital
    Equipment Corporation in the 1970s or 1980s.
    https://en.wikipedia.org/wiki/Internationalization_and_localization

    In some of my Prolog systems I started providing
    i18n databases via a multifile strings/3 predicate,
    using some ISO local identifier logic to access
    fact from the strings/3 predicate, in a manner
    that Java accesses resource bundles.

    But to access Prolog error texts, I went a step
    further and started dynamically matching template
    strings from strings/3 and supply it to format/3.
    So layering the matter on format/3. But sometimes
    it makes sense to fetch a i18n

    as a atom or string instead of sending it
    to a stream. So I complemented the predicate
    put_message/[2,3] by a predicate get_message/[2,3],
    the former tolerates missing template strings
    the later indicates missing template strings

    by a failure. Here is a use case of get_message/[2,3]
    not really using the failure and success status,
    but rather showing the reification in the last
    argument, GNU time -f inspired:

    time(Goal) :-
    get_message(time(fields), Format),
    time(Goal, Format).

    strings('time.fields', '', '% %t, %p, %l').

    SWI Prolog probably can do that as well, if it
    would redirect the output stream to atom(A) or
    string(S). But get_message/[2,3] does reification
    without redirection, so there are no multithreading
    reentrance issues or whatever.

    Bye

    BTW: Having all the i18n data as strings is
    sometimes more user friendly.

    Mild Shock schrieb:
    Hi,

    Somehow this link is broken ( Not Found ):

    *0106.0 Float enhancements Draft* https://prolog-lang.org/ImprovementsForum/0106-floats-enhancements.html

    Also there is no consensus between ECLiPSe and SWI in realization:
    ```
    /* Version 7.1beta #13 (x86_64_nt) */
    [eclipse 5]: X is min(1.5NaN, 3).
    X = 3.0
    Yes (0.00s cpu)
    [eclipse 6]: X is min(3, 1.5NaN).
    X = 1.5NaN
    Yes (0.00s cpu)

    /* SWI-Prolog (threaded, 64 bits, version 10.1.1) */
    ?- X is min(1.5NaN, 3).
    X = 1.5NaN.
    ?- X is min(3, 1.5NaN).
    X = 1.5NaN.
    ```
    Mostlikely SWI uses IEEE minimum. While ECLiPSe uses (a < b ? a : b).

    Bye

    P.S.: I am planning a kind of IEEE minNum behaviour:
    ```
    /* Dogelog Player 2.2.1 */
    ?- X is min(0rNaN, 3).
    X = 3.
    ?- X is min(3, 0rNaN).
    X = 3.
    ```
    Note that there is no coercion of 3 into 3.0.


    Mild Shock schrieb:
    Hi,

    Functional requirement:

    ?- Y = g(_,_), X = f(Y,C,D,Y), term_singletons(X, L),
    -a-a-a L == [C,D].

    ?- Y = g(A,X,B), X = f(Y,C,D), term_singletons(X, L),
    -a-a-a L == [A,B,C,D].

    Non-Functional requirement:

    ?- member(N,[5,10,15]), time(singletons(N)), fail; true.
    % Zeit 1 ms, GC 0 ms, Lips 4046000, Uhr 11.08.2025 01:36
    % Zeit 3 ms, GC 0 ms, Lips 1352000, Uhr 11.08.2025 01:36
    % Zeit 3 ms, GC 0 ms, Lips 1355333, Uhr 11.08.2025 01:36
    true.

    Can your Prolog system do that?

    P.S.: Benchmark was:

    singletons(N) :-
    -a-a-a hydra2(N,Y),
    -a-a-a between(1,1000,_), term_singletons(Y,_), fail; true.

    hydra2(0, _) :- !.
    hydra2(N, s(X,X)) :-
    -a-a-a M is N-1,
    -a-a-a hydra2(M, X).

    Bye


    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Thu Aug 13 18:02:29 2026
    From Newsgroup: comp.lang.prolog

    Hi,

    hurufu evacuated:
    As a pragmatic developer, I would really
    appreciate tight integration with already
    existing gettext or catopen families of
    functions and tooling (for example poedit).
    I would like to see Prolog as a usual boring
    desktop programming language. But this will
    require standard FFI bindings to libc or
    complete re-implementation.

    Can you tell us more about these libraries
    and their functionality. My idea is basically
    that deep down it can be a hybrid of strings/3
    FFI and the Prolog ISO knowledge bases, since
    strings/3 is multifile

    but not necessarily dynamic. Namely the primary
    use is as a static predicate, and for example
    use consult/1 or use_module/1 can even load
    strings/3 definitions on demand. It basically
    utilizes the multifile

    feature as defined in the ISO core standard.
    So it is a solution that is portable, would
    work everywhere where you find a ISO processor,
    and currently it requires also format/[2,3]
    and memory streams to do the reification.

    There is a PIP now for format[2,3], but I
    donrCOt see a PIP for memory streams yet:

    Draft PIP-0110-format https://discourse.prolog-lang.org/t/draft-pip-0110-format/170

    Draft PIP-???-memory https://discourse.prolog-lang.org/t/draft-pip-???-format/???

    What is possible with the strings/3 approach
    to make a hybrid or even drop strings/3 consulted
    from some Prolog texts altogether, by tapping
    into some FFI. Namely you would to:

    /**
    * strings(K, L, V):
    * The predicate succeeds in V with the value
    * for the key K and the local L.
    */
    % strings(+Atom, +Atom, -Atom)
    :- multifile strings/3
    strings(K, L, V) :-
    ffi_lookup_string(K, L, V).

    You can mixin multiple resource bundle oracles
    via FFIs, since the predicate is defined using
    the ISO core multifile directive. The strings/3
    predicate works with first argument indexing

    in primitive Prolog systems already quite well,
    I use compressed atomified key such as rCytime.fieldsrCO.
    It works a little better with more advanced Prolog
    systems that have multi argument indexing,

    since it would then also index the local. The
    challenge for a FFI is to retain these Prolog traits,
    give ffi_lookup_string/3 a similar nice performance
    profile, and extensibility as found via consult/1.

    Bye

    Mild Shock schrieb:
    Hi,

    Somehow I didnrCOt find any PIP yet for Intern-
    ationalization. I think SWI prolog has a messaging
    infrastructure, which can also generated messages
    in different languages. Probably inspired or
    inherited by Quintus Prolog.

    I did once some research and somehow saw something
    similar in Quintus Prolog. It also inspired Pillow,
    a web library, where output was seen as producing a
    message. Recently it occured to me more and more
    that it would be usefull to have multiple

    languages bundled into a single app.

    Internationalization and Localization
    The idea is often abbreviated to i18n (where
    18 stands for the number of letters between
    the first i and the last n in the word
    internationalization, a usage coined at Digital
    Equipment Corporation in the 1970s or 1980s.
    https://en.wikipedia.org/wiki/Internationalization_and_localization

    In some of my Prolog systems I started providing
    i18n databases via a multifile strings/3 predicate,
    using some ISO local identifier logic to access
    fact from the strings/3 predicate, in a manner
    that Java accesses resource bundles.

    But to access Prolog error texts, I went a step
    further and started dynamically matching template
    strings from strings/3 and supply it to format/3.
    So layering the matter on format/3. But sometimes
    it makes sense to fetch a i18n

    as a atom or string instead of sending it
    to a stream. So I complemented the predicate
    put_message/[2,3] by a predicate get_message/[2,3],
    the former tolerates missing template strings
    the later indicates missing template strings

    by a failure. Here is a use case of get_message/[2,3]
    not really using the failure and success status,
    but rather showing the reification in the last
    argument, GNU time -f inspired:

    time(Goal) :-
    -a-a get_message(time(fields), Format),
    -a-a time(Goal, Format).

    strings('time.fields', '', '% %t, %p, %l').

    SWI Prolog probably can do that as well, if it
    would redirect the output stream to atom(A) or
    string(S). But get_message/[2,3] does reification
    without redirection, so there are no multithreading
    reentrance issues or whatever.

    Bye

    BTW: Having all the i18n data as strings is
    sometimes more user friendly.

    Mild Shock schrieb:
    Hi,

    Somehow this link is broken ( Not Found ):

    *0106.0 Float enhancements Draft*
    https://prolog-lang.org/ImprovementsForum/0106-floats-enhancements.html

    Also there is no consensus between ECLiPSe and SWI in realization:
    ```
    /* Version 7.1beta #13 (x86_64_nt) */
    [eclipse 5]: X is min(1.5NaN, 3).
    X = 3.0
    Yes (0.00s cpu)
    [eclipse 6]: X is min(3, 1.5NaN).
    X = 1.5NaN
    Yes (0.00s cpu)

    /* SWI-Prolog (threaded, 64 bits, version 10.1.1) */
    ?- X is min(1.5NaN, 3).
    X = 1.5NaN.
    ?- X is min(3, 1.5NaN).
    X = 1.5NaN.
    ```
    Mostlikely SWI uses IEEE minimum. While ECLiPSe uses (a < b ? a : b).

    Bye

    P.S.: I am planning a kind of IEEE minNum behaviour:
    ```
    /* Dogelog Player 2.2.1 */
    ?- X is min(0rNaN, 3).
    X = 3.
    ?- X is min(3, 0rNaN).
    X = 3.
    ```
    Note that there is no coercion of 3 into 3.0.


    Mild Shock schrieb:
    Hi,

    Functional requirement:

    ?- Y = g(_,_), X = f(Y,C,D,Y), term_singletons(X, L),
    -a-a-a L == [C,D].

    ?- Y = g(A,X,B), X = f(Y,C,D), term_singletons(X, L),
    -a-a-a L == [A,B,C,D].

    Non-Functional requirement:

    ?- member(N,[5,10,15]), time(singletons(N)), fail; true.
    % Zeit 1 ms, GC 0 ms, Lips 4046000, Uhr 11.08.2025 01:36
    % Zeit 3 ms, GC 0 ms, Lips 1352000, Uhr 11.08.2025 01:36
    % Zeit 3 ms, GC 0 ms, Lips 1355333, Uhr 11.08.2025 01:36
    true.

    Can your Prolog system do that?

    P.S.: Benchmark was:

    singletons(N) :-
    -a-a-a hydra2(N,Y),
    -a-a-a between(1,1000,_), term_singletons(Y,_), fail; true.

    hydra2(0, _) :- !.
    hydra2(N, s(X,X)) :-
    -a-a-a M is N-1,
    -a-a-a hydra2(M, X).

    Bye



    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Thu Aug 13 18:04:50 2026
    From Newsgroup: comp.lang.prolog

    Hi,

    I donrCOt see a PIP for memory streams yet:
    Draft PIP-???-memory https://discourse.prolog-lang.org/t/draft-pip-???-format/???

    What comes handy as memory streams is adopting
    the API from GNU Prolog. For example I can easily
    add reification to format/[2,3] via this implementation:

    /**
    * format_atom(T, L, A):
    * The build-in succeeds in writing the list L formatted
    * according to the template T into a new atom A.
    */
    % format_atom(+Atom, +List, -Atom)
    format_atom(T, L, A) :-
    open_output_atom_stream(K),
    format(K, T, L),
    close_output_atom_stream(K, A).

    All I had to do was implement open_output_atom_stream/2
    and close_output_atom_stream/2 as already defined
    by GNU Prolog, and a big deal of reification was

    solved. You find GNU Prolog memory streams here:

    7.11 Constant term streams https://www.cse.iitb.ac.in/~cs206/Html/manual034.html

    But counting my Prolog system implementation,
    there is not yet a quorum of 2 Prolog systems.
    Because my memory streams are garbage collected
    by the garbage collector of

    the host programming language, I donrCOt need
    a predicate close_input_atom_stream/1. It gets
    finalize by the garbage collector, whereby I even
    donrCOt need a finalize() method implementation, the

    internal datastructure just bites the dust.

    Bye

    Mild Shock schrieb:
    Hi,

    hurufu evacuated:
    As a pragmatic developer, I would really
    appreciate tight integration with already
    existing gettext or catopen families of
    functions and tooling (for example poedit).
    I would like to see Prolog as a usual boring
    desktop programming language. But this will
    require standard FFI bindings to libc or
    complete re-implementation.

    Can you tell us more about these libraries
    and their functionality. My idea is basically
    that deep down it can be a hybrid of strings/3
    FFI and the Prolog ISO knowledge bases, since
    strings/3 is multifile

    but not necessarily dynamic. Namely the primary
    use is as a static predicate, and for example
    use consult/1 or use_module/1 can even load
    strings/3 definitions on demand. It basically
    utilizes the multifile

    feature as defined in the ISO core standard.
    So it is a solution that is portable, would
    work everywhere where you find a ISO processor,
    and currently it requires also format/[2,3]
    and memory streams to do the reification.

    There is a PIP now for format[2,3], but I
    donrCOt see a PIP for memory streams yet:

    Draft PIP-0110-format https://discourse.prolog-lang.org/t/draft-pip-0110-format/170

    Draft PIP-???-memory https://discourse.prolog-lang.org/t/draft-pip-???-format/???

    What is possible with the strings/3 approach
    to make a hybrid or even drop strings/3 consulted
    from some Prolog texts altogether, by tapping
    into some FFI. Namely you would to:

    /**
    -a* strings(K, L, V):
    -a* The predicate succeeds in V with the value
    -a* for the key K and the local L.
    -a*/
    % strings(+Atom, +Atom, -Atom)
    :- multifile strings/3
    strings(K, L, V) :-
    -a-a ffi_lookup_string(K, L, V).

    You can mixin multiple resource bundle oracles
    via FFIs, since the predicate is defined using
    the ISO core multifile directive. The strings/3
    predicate works with first argument indexing

    in primitive Prolog systems already quite well,
    I use compressed atomified key such as rCytime.fieldsrCO.
    It works a little better with more advanced Prolog
    systems that have multi argument indexing,

    since it would then also index the local. The
    challenge for a FFI is to retain these Prolog traits,
    give ffi_lookup_string/3 a similar nice performance
    profile, and extensibility as found via consult/1.

    Bye

    Mild Shock schrieb:
    Hi,

    Somehow I didnrCOt find any PIP yet for Intern-
    ationalization. I think SWI prolog has a messaging
    infrastructure, which can also generated messages
    in different languages. Probably inspired or
    inherited by Quintus Prolog.

    I did once some research and somehow saw something
    similar in Quintus Prolog. It also inspired Pillow,
    a web library, where output was seen as producing a
    message. Recently it occured to me more and more
    that it would be usefull to have multiple

    languages bundled into a single app.

    Internationalization and Localization
    The idea is often abbreviated to i18n (where
    18 stands for the number of letters between
    the first i and the last n in the word
    internationalization, a usage coined at Digital
    Equipment Corporation in the 1970s or 1980s.
    https://en.wikipedia.org/wiki/Internationalization_and_localization

    In some of my Prolog systems I started providing
    i18n databases via a multifile strings/3 predicate,
    using some ISO local identifier logic to access
    fact from the strings/3 predicate, in a manner
    that Java accesses resource bundles.

    But to access Prolog error texts, I went a step
    further and started dynamically matching template
    strings from strings/3 and supply it to format/3.
    So layering the matter on format/3. But sometimes
    it makes sense to fetch a i18n

    as a atom or string instead of sending it
    to a stream. So I complemented the predicate
    put_message/[2,3] by a predicate get_message/[2,3],
    the former tolerates missing template strings
    the later indicates missing template strings

    by a failure. Here is a use case of get_message/[2,3]
    not really using the failure and success status,
    but rather showing the reification in the last
    argument, GNU time -f inspired:

    time(Goal) :-
    -a-a-a get_message(time(fields), Format),
    -a-a-a time(Goal, Format).

    strings('time.fields', '', '% %t, %p, %l').

    SWI Prolog probably can do that as well, if it
    would redirect the output stream to atom(A) or
    string(S). But get_message/[2,3] does reification
    without redirection, so there are no multithreading
    reentrance issues or whatever.

    Bye

    BTW: Having all the i18n data as strings is
    sometimes more user friendly.

    Mild Shock schrieb:
    Hi,

    Somehow this link is broken ( Not Found ):

    *0106.0 Float enhancements Draft*
    https://prolog-lang.org/ImprovementsForum/0106-floats-enhancements.html

    Also there is no consensus between ECLiPSe and SWI in realization:
    ```
    /* Version 7.1beta #13 (x86_64_nt) */
    [eclipse 5]: X is min(1.5NaN, 3).
    X = 3.0
    Yes (0.00s cpu)
    [eclipse 6]: X is min(3, 1.5NaN).
    X = 1.5NaN
    Yes (0.00s cpu)

    /* SWI-Prolog (threaded, 64 bits, version 10.1.1) */
    ?- X is min(1.5NaN, 3).
    X = 1.5NaN.
    ?- X is min(3, 1.5NaN).
    X = 1.5NaN.
    ```
    Mostlikely SWI uses IEEE minimum. While ECLiPSe uses (a < b ? a : b).

    Bye

    P.S.: I am planning a kind of IEEE minNum behaviour:
    ```
    /* Dogelog Player 2.2.1 */
    ?- X is min(0rNaN, 3).
    X = 3.
    ?- X is min(3, 0rNaN).
    X = 3.
    ```
    Note that there is no coercion of 3 into 3.0.


    Mild Shock schrieb:
    Hi,

    Functional requirement:

    ?- Y = g(_,_), X = f(Y,C,D,Y), term_singletons(X, L),
    -a-a-a L == [C,D].

    ?- Y = g(A,X,B), X = f(Y,C,D), term_singletons(X, L),
    -a-a-a L == [A,B,C,D].

    Non-Functional requirement:

    ?- member(N,[5,10,15]), time(singletons(N)), fail; true.
    % Zeit 1 ms, GC 0 ms, Lips 4046000, Uhr 11.08.2025 01:36
    % Zeit 3 ms, GC 0 ms, Lips 1352000, Uhr 11.08.2025 01:36
    % Zeit 3 ms, GC 0 ms, Lips 1355333, Uhr 11.08.2025 01:36
    true.

    Can your Prolog system do that?

    P.S.: Benchmark was:

    singletons(N) :-
    -a-a-a hydra2(N,Y),
    -a-a-a between(1,1000,_), term_singletons(Y,_), fail; true.

    hydra2(0, _) :- !.
    hydra2(N, s(X,X)) :-
    -a-a-a M is N-1,
    -a-a-a hydra2(M, X).

    Bye




    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Thu Aug 13 19:51:26 2026
    From Newsgroup: comp.lang.prolog

    Hi,

    hurufu opinioned:
    But translation from term to
    atom is quite trivial.

    You must be joking Mr. Feynman. How? You need also
    to respect a locale as a formal parameter. You find
    hardly anybody doing this inside Prolog system so
    far. The maximum is some flag where

    sometimes a shell setting is respected. But a
    formal parameter in the API that has a ISO locale
    atom is hardly found. For example Java bought it in
    via 3rd party classes from TaligentrCOs Text and

    International group (*), by way of Mark Davis, Unicode.
    SWI Prolog doesnrCOt do that right now. With a ISO
    locale atom as insuinated in the PIP one could
    have the following behaviour of a single app:

    ?- current_prolog_flag(sys_locale, X).
    X = de_CH.

    ?- X is 1/0.
    EfU? Fehler: Nulldivision.
    user auf 3

    ?- set_prolog_flag(sys_locale, en_GB).
    true.

    ?- X is 1/0.
    EfU? Error: Division by zero.
    user at 5

    If there were no locale involved I would only
    suggest strings/2 as the database, and it wouldnrCOt
    be a internationalization database anymore that
    covers multiple languages. But the PIP here

    explicitly mentions strings/3 with arity 3 and
    not only arity 2. This allows what the PIP describes
    as having multiple languages bundled into a single
    app. Some people use the term globalization and not

    internationalization for such apps, but I am a
    little old fashioned here. Also without locale
    there would be only put_message/2 and get_message/2,
    and no put_message/3 and get_message/3 where one

    can even explicitly supply a ISO locale identifier.

    BTW: All that SWI-Prolog uses is:

    iso_message(evaluation_error(Which)) -->
    [ 'Arithmetic: evaluation error: `~p'''-[Which] ].

    No internationalization at all, no multiple languages.

    Bye

    (*) https://icu-project.org/docs/papers/history_of_java_internationalization.html

    Mild Shock schrieb:
    Hi,

    I donrCOt see a PIP for memory streams yet:
    Draft PIP-???-memory https://discourse.prolog-lang.org/t/draft-pip-???-format/???

    What comes handy as memory streams is adopting
    the API from GNU Prolog. For example I can easily
    add reification to format/[2,3] via this implementation:

    /**
    -a* format_atom(T, L, A):
    -a* The build-in succeeds in writing the list L formatted
    -a* according to the template T into a new atom A.
    -a*/
    % format_atom(+Atom, +List, -Atom)
    format_atom(T, L, A) :-
    -a-a open_output_atom_stream(K),
    -a-a format(K, T, L),
    -a-a close_output_atom_stream(K, A).

    All I had to do was implement open_output_atom_stream/2
    and close_output_atom_stream/2 as already defined
    by GNU Prolog, and a big deal of reification was

    solved. You find GNU Prolog memory streams here:

    7.11 Constant term streams https://www.cse.iitb.ac.in/~cs206/Html/manual034.html

    But counting my Prolog system implementation,
    there is not yet a quorum of 2 Prolog systems.
    Because my memory streams are garbage collected
    by the garbage collector of

    the host programming language, I donrCOt need
    a predicate close_input_atom_stream/1. It gets
    finalize by the garbage collector, whereby I even
    donrCOt need a finalize() method implementation, the

    internal datastructure just bites the dust.

    Bye

    Mild Shock schrieb:
    Hi,

    hurufu evacuated:
    As a pragmatic developer, I would really
    appreciate tight integration with already
    existing gettext or catopen families of
    functions and tooling (for example poedit).
    I would like to see Prolog as a usual boring
    desktop programming language. But this will
    require standard FFI bindings to libc or
    complete re-implementation.

    Can you tell us more about these libraries
    and their functionality. My idea is basically
    that deep down it can be a hybrid of strings/3
    FFI and the Prolog ISO knowledge bases, since
    strings/3 is multifile

    but not necessarily dynamic. Namely the primary
    use is as a static predicate, and for example
    use consult/1 or use_module/1 can even load
    strings/3 definitions on demand. It basically
    utilizes the multifile

    feature as defined in the ISO core standard.
    So it is a solution that is portable, would
    work everywhere where you find a ISO processor,
    and currently it requires also format/[2,3]
    and memory streams to do the reification.

    There is a PIP now for format[2,3], but I
    donrCOt see a PIP for memory streams yet:

    Draft PIP-0110-format
    https://discourse.prolog-lang.org/t/draft-pip-0110-format/170

    Draft PIP-???-memory
    https://discourse.prolog-lang.org/t/draft-pip-???-format/???

    What is possible with the strings/3 approach
    to make a hybrid or even drop strings/3 consulted
    from some Prolog texts altogether, by tapping
    into some FFI. Namely you would to:

    /**
    -a-a* strings(K, L, V):
    -a-a* The predicate succeeds in V with the value
    -a-a* for the key K and the local L.
    -a-a*/
    % strings(+Atom, +Atom, -Atom)
    :- multifile strings/3
    strings(K, L, V) :-
    -a-a-a ffi_lookup_string(K, L, V).

    You can mixin multiple resource bundle oracles
    via FFIs, since the predicate is defined using
    the ISO core multifile directive. The strings/3
    predicate works with first argument indexing

    in primitive Prolog systems already quite well,
    I use compressed atomified key such as rCytime.fieldsrCO.
    It works a little better with more advanced Prolog
    systems that have multi argument indexing,

    since it would then also index the local. The
    challenge for a FFI is to retain these Prolog traits,
    give ffi_lookup_string/3 a similar nice performance
    profile, and extensibility as found via consult/1.

    Bye

    Mild Shock schrieb:
    Hi,

    Somehow I didnrCOt find any PIP yet for Intern-
    ationalization. I think SWI prolog has a messaging
    infrastructure, which can also generated messages
    in different languages. Probably inspired or
    inherited by Quintus Prolog.

    I did once some research and somehow saw something
    similar in Quintus Prolog. It also inspired Pillow,
    a web library, where output was seen as producing a
    message. Recently it occured to me more and more
    that it would be usefull to have multiple

    languages bundled into a single app.

    Internationalization and Localization
    The idea is often abbreviated to i18n (where
    18 stands for the number of letters between
    the first i and the last n in the word
    internationalization, a usage coined at Digital
    Equipment Corporation in the 1970s or 1980s.
    https://en.wikipedia.org/wiki/Internationalization_and_localization

    In some of my Prolog systems I started providing
    i18n databases via a multifile strings/3 predicate,
    using some ISO local identifier logic to access
    fact from the strings/3 predicate, in a manner
    that Java accesses resource bundles.

    But to access Prolog error texts, I went a step
    further and started dynamically matching template
    strings from strings/3 and supply it to format/3.
    So layering the matter on format/3. But sometimes
    it makes sense to fetch a i18n

    as a atom or string instead of sending it
    to a stream. So I complemented the predicate
    put_message/[2,3] by a predicate get_message/[2,3],
    the former tolerates missing template strings
    the later indicates missing template strings

    by a failure. Here is a use case of get_message/[2,3]
    not really using the failure and success status,
    but rather showing the reification in the last
    argument, GNU time -f inspired:

    time(Goal) :-
    -a-a-a get_message(time(fields), Format),
    -a-a-a time(Goal, Format).

    strings('time.fields', '', '% %t, %p, %l').

    SWI Prolog probably can do that as well, if it
    would redirect the output stream to atom(A) or
    string(S). But get_message/[2,3] does reification
    without redirection, so there are no multithreading
    reentrance issues or whatever.

    Bye

    BTW: Having all the i18n data as strings is
    sometimes more user friendly.

    Mild Shock schrieb:
    Hi,

    Somehow this link is broken ( Not Found ):

    *0106.0 Float enhancements Draft*
    https://prolog-lang.org/ImprovementsForum/0106-floats-enhancements.html >>>>
    Also there is no consensus between ECLiPSe and SWI in realization:
    ```
    /* Version 7.1beta #13 (x86_64_nt) */
    [eclipse 5]: X is min(1.5NaN, 3).
    X = 3.0
    Yes (0.00s cpu)
    [eclipse 6]: X is min(3, 1.5NaN).
    X = 1.5NaN
    Yes (0.00s cpu)

    /* SWI-Prolog (threaded, 64 bits, version 10.1.1) */
    ?- X is min(1.5NaN, 3).
    X = 1.5NaN.
    ?- X is min(3, 1.5NaN).
    X = 1.5NaN.
    ```
    Mostlikely SWI uses IEEE minimum. While ECLiPSe uses (a < b ? a : b).

    Bye

    P.S.: I am planning a kind of IEEE minNum behaviour:
    ```
    /* Dogelog Player 2.2.1 */
    ?- X is min(0rNaN, 3).
    X = 3.
    ?- X is min(3, 0rNaN).
    X = 3.
    ```
    Note that there is no coercion of 3 into 3.0.


    Mild Shock schrieb:
    Hi,

    Functional requirement:

    ?- Y = g(_,_), X = f(Y,C,D,Y), term_singletons(X, L),
    -a-a-a L == [C,D].

    ?- Y = g(A,X,B), X = f(Y,C,D), term_singletons(X, L),
    -a-a-a L == [A,B,C,D].

    Non-Functional requirement:

    ?- member(N,[5,10,15]), time(singletons(N)), fail; true.
    % Zeit 1 ms, GC 0 ms, Lips 4046000, Uhr 11.08.2025 01:36
    % Zeit 3 ms, GC 0 ms, Lips 1352000, Uhr 11.08.2025 01:36
    % Zeit 3 ms, GC 0 ms, Lips 1355333, Uhr 11.08.2025 01:36
    true.

    Can your Prolog system do that?

    P.S.: Benchmark was:

    singletons(N) :-
    -a-a-a hydra2(N,Y),
    -a-a-a between(1,1000,_), term_singletons(Y,_), fail; true.

    hydra2(0, _) :- !.
    hydra2(N, s(X,X)) :-
    -a-a-a M is N-1,
    -a-a-a hydra2(M, X).

    Bye





    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Thu Aug 13 22:37:09 2026
    From Newsgroup: comp.lang.prolog

    Hi,

    About the price tag for using a multifile/1
    directives in your Prolog code, instead of
    some libc binding: Effort practically zero,

    just write the directive before your clauses
    in every file you define strings/3. Learning
    curve practically zero, at least I assume so,

    multifile/1 directive is very intuitive. So the
    bottomline is you didnrCOt buy the ISO Prolog
    core standard, and also you didnrCOt buy the

    ISO POSIX standard, 400 pages fresh from the
    Austin group, in a classic English office park in
    Berkshire, costs only 226 CHF in 2026.

    Bye

    Mild Shock schrieb:
    Hi,

    Somehow I didnrCOt find any PIP yet for Intern-
    ationalization. I think SWI prolog has a messaging
    infrastructure, which can also generated messages
    in different languages. Probably inspired or
    inherited by Quintus Prolog.

    I did once some research and somehow saw something
    similar in Quintus Prolog. It also inspired Pillow,
    a web library, where output was seen as producing a
    message. Recently it occured to me more and more
    that it would be usefull to have multiple

    languages bundled into a single app.

    Internationalization and Localization
    The idea is often abbreviated to i18n (where
    18 stands for the number of letters between
    the first i and the last n in the word
    internationalization, a usage coined at Digital
    Equipment Corporation in the 1970s or 1980s.
    https://en.wikipedia.org/wiki/Internationalization_and_localization

    In some of my Prolog systems I started providing
    i18n databases via a multifile strings/3 predicate,
    using some ISO local identifier logic to access
    fact from the strings/3 predicate, in a manner
    that Java accesses resource bundles.

    But to access Prolog error texts, I went a step
    further and started dynamically matching template
    strings from strings/3 and supply it to format/3.
    So layering the matter on format/3. But sometimes
    it makes sense to fetch a i18n

    as a atom or string instead of sending it
    to a stream. So I complemented the predicate
    put_message/[2,3] by a predicate get_message/[2,3],
    the former tolerates missing template strings
    the later indicates missing template strings

    by a failure. Here is a use case of get_message/[2,3]
    not really using the failure and success status,
    but rather showing the reification in the last
    argument, GNU time -f inspired:

    time(Goal) :-
    -a-a get_message(time(fields), Format),
    -a-a time(Goal, Format).

    strings('time.fields', '', '% %t, %p, %l').

    SWI Prolog probably can do that as well, if it
    would redirect the output stream to atom(A) or
    string(S). But get_message/[2,3] does reification
    without redirection, so there are no multithreading
    reentrance issues or whatever.

    Bye

    BTW: Having all the i18n data as strings is
    sometimes more user friendly.

    Mild Shock schrieb:
    Hi,

    Somehow this link is broken ( Not Found ):

    *0106.0 Float enhancements Draft*
    https://prolog-lang.org/ImprovementsForum/0106-floats-enhancements.html

    Also there is no consensus between ECLiPSe and SWI in realization:
    ```
    /* Version 7.1beta #13 (x86_64_nt) */
    [eclipse 5]: X is min(1.5NaN, 3).
    X = 3.0
    Yes (0.00s cpu)
    [eclipse 6]: X is min(3, 1.5NaN).
    X = 1.5NaN
    Yes (0.00s cpu)

    /* SWI-Prolog (threaded, 64 bits, version 10.1.1) */
    ?- X is min(1.5NaN, 3).
    X = 1.5NaN.
    ?- X is min(3, 1.5NaN).
    X = 1.5NaN.
    ```
    Mostlikely SWI uses IEEE minimum. While ECLiPSe uses (a < b ? a : b).

    Bye

    P.S.: I am planning a kind of IEEE minNum behaviour:
    ```
    /* Dogelog Player 2.2.1 */
    ?- X is min(0rNaN, 3).
    X = 3.
    ?- X is min(3, 0rNaN).
    X = 3.
    ```
    Note that there is no coercion of 3 into 3.0.


    Mild Shock schrieb:
    Hi,

    Functional requirement:

    ?- Y = g(_,_), X = f(Y,C,D,Y), term_singletons(X, L),
    -a-a-a L == [C,D].

    ?- Y = g(A,X,B), X = f(Y,C,D), term_singletons(X, L),
    -a-a-a L == [A,B,C,D].

    Non-Functional requirement:

    ?- member(N,[5,10,15]), time(singletons(N)), fail; true.
    % Zeit 1 ms, GC 0 ms, Lips 4046000, Uhr 11.08.2025 01:36
    % Zeit 3 ms, GC 0 ms, Lips 1352000, Uhr 11.08.2025 01:36
    % Zeit 3 ms, GC 0 ms, Lips 1355333, Uhr 11.08.2025 01:36
    true.

    Can your Prolog system do that?

    P.S.: Benchmark was:

    singletons(N) :-
    -a-a-a hydra2(N,Y),
    -a-a-a between(1,1000,_), term_singletons(Y,_), fail; true.

    hydra2(0, _) :- !.
    hydra2(N, s(X,X)) :-
    -a-a-a M is N-1,
    -a-a-a hydra2(M, X).

    Bye



    --- Synchronet 3.22a-Linux NewsLink 1.2