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
minimumNumber/maximumNumber which do propagate NaN.
9.6 Minimum and maximum operations
sourceFormat minimum(source, source)
sourceFormat minimumNumber(source, source)
sourceFormat maximum(source, source)
sourceFormat maximumNumber(source, source)
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.
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
Internationalization and Localizationhttps://en.wikipedia.org/wiki/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.
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
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.
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 Localizationhttps://en.wikipedia.org/wiki/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.
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
I donrCOt see a PIP for memory streams yet:
Draft PIP-???-memory https://discourse.prolog-lang.org/t/draft-pip-???-format/???
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 Localizationhttps://en.wikipedia.org/wiki/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.
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
But translation from term toatom is quite trivial.
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 Localizationhttps://en.wikipedia.org/wiki/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.
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
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 Localizationhttps://en.wikipedia.org/wiki/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.
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
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 74 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 55:01:05 |
| Calls: | 1,101 |
| Calls today: | 1 |
| Files: | 1,339 |
| Messages: | 276,444 |