Hi,
Functional requirement:
?- Y = g(_,_), X = f(Y,C,D,Y), term_singletons(X, L),
L == [C,D].
?- Y = g(A,X,B), X = f(Y,C,D), term_singletons(X, L),
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) :-
hydra2(N,Y),
between(1,1000,_), term_singletons(Y,_), fail; true.
hydra2(0, _) :- !.
hydra2(N, s(X,X)) :-
M is N-1,
hydra2(M, X).
Bye
Hi,
Now I wish I had a Prolog system at hand that
could do what one could see in an old version of
LPA Prolog, and even going beyond. Namely:
print(X | Y) :- write(X), maplist(write, Y).
So basically the list head and tail matching for
Prolog compounds. It has an additional challenge,
how does the Prolog predicate catalogue look
like. There is now a variadic predicate. But on
2nd though and looking at Java Script, which has
a prefix operator (...)/1 which can be used for:
- **Rest Patterns:**
One can define function print(X, ...Y) which
is pretty much the same as the above.
- **Spread Replacement:**
But one can also invoke print(Z, ...V, ...W) which
goes beyond a head tail inside a unify read.
What would be a benefit? For example call/n could
be the variadic definition, showing a further feature,
namely Prolog variables at functor positions:
call(F(...A), ...B) :- F(...A, ...B).
Bye
Mild Shock schrieb:
Hi,
Functional requirement:
?- Y = g(_,_), X = f(Y,C,D,Y), term_singletons(X, L),
L == [C,D].
?- Y = g(A,X,B), X = f(Y,C,D), term_singletons(X, L),
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) :-
hydra2(N,Y),
between(1,1000,_), term_singletons(Y,_), fail; true.
hydra2(0, _) :- !.
hydra2(N, s(X,X)) :-
M is N-1,
hydra2(M, X).
Bye
Hi,
Currently I have a dozen solutions on a back
of a envelope but cannot decide what to implement.
I am also examing my native call/n implementation,
which is in Java to learn what was used and whether
we can abstract some new code instructions, and
marveling at the C# Span struct:
- Prolog compound creation:
The call/n implementation differes from
other Prolog compound creations in that
new Object[] is called with a computed arity.
The arity formula for spread replacement is:
arity(F(...A, ...B)) = arity(A) + arity(B)
- Prolog compound population
The call/n implementation differs from
other Prolog compound creations in that
System.arraycopy() is called with computed
destination indexes:
dst(...A) = 0
dst(...B) = arity(A)
- Prolog compound matching
The call/n implementation doesn't do much.
It it knows that ...A is from the compound
F(...) and that ...B is from the compound
call(...), so a rest pattern is a pair of compound
and source indexes, the used in System.arraycopy().
src(...A) = 0
src(...B) = 1
Interstingly C# has institutionalized a lightweight
struct Span, according All About Span: Exploring a
New .NET Mainstay By Stephen Toub | January 2018.
So I was thinking of converting a span ...X into
two Prolog variables X1 and X2, where X1 points to
the parent compound and X2 is the offset.
But if we only allow a single rest pattern, in the spirit
of LPA Prolog, X2 will be a constant that the Prolog
compiler knows from the given rest pattern.
So its still only one Prolog logical variable!
Bye
Mild Shock schrieb:
Hi,
Now I wish I had a Prolog system at hand that
could do what one could see in an old version of
LPA Prolog, and even going beyond. Namely:
print(X | Y) :- write(X), maplist(write, Y).
So basically the list head and tail matching for
Prolog compounds. It has an additional challenge,
how does the Prolog predicate catalogue look
like. There is now a variadic predicate. But on
2nd though and looking at Java Script, which has
a prefix operator (...)/1 which can be used for:
- **Rest Patterns:**
One can define function print(X, ...Y) which
is pretty much the same as the above.
- **Spread Replacement:**
But one can also invoke print(Z, ...V, ...W) which
goes beyond a head tail inside a unify read.
What would be a benefit? For example call/n could
be the variadic definition, showing a further feature,
namely Prolog variables at functor positions:
call(F(...A), ...B) :- F(...A, ...B).
Bye
Mild Shock schrieb:
Hi,
Functional requirement:
?- Y = g(_,_), X = f(Y,C,D,Y), term_singletons(X, L),
L == [C,D].
?- Y = g(A,X,B), X = f(Y,C,D), term_singletons(X, L),
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) :-
hydra2(N,Y),
between(1,1000,_), term_singletons(Y,_), fail; true.
hydra2(0, _) :- !.
hydra2(N, s(X,X)) :-
M is N-1,
hydra2(M, X).
Bye
Hi,
I see the following benefit of superintelligence
as a pair programming model over some internet
community. This is based of my experience
over the last weeks:
- Benefit of Superintelligence:
The superintelligence might not be the design
lead that carries the main idea and makes the
important decisions. Still ChatGPT, DeepSeek, etc..
are exceptionally useful as RTFM slaves.
- Drawback I of Community:
Human communities are execeptionally bad at RTFM,
as the case of Julio the Nazi Retard shows.
He was even not able to organize a copy of the
ISO core standard document.
- Dawback II of Community:
Human communities tend to become vanity churches,
where everybody can leave a mark, even when its
a little pile of poo. An excellent example is golangs
short function literals. Miles and miles since 2022,
but no implementation yet:
proposal: spec: short function literals #21498 https://github.com/golang/go/issues/21498#issuecomment-1132271548
Drawback II is used by many big companies, such
as Google, Apple, etc.. The goal of this use of
social media is to act as magnet, and to tweek
SEO, search engine optimization.
Thats the same goal behind SWI-Prolog discourse,
just produce miles and miles of tapestry of
poo pile, doesn't matter. The most important thing
is to attract more and more cows (and flies),
to fill the common land (Almend in German):
Das Wort Allmende stammt aus dem altnordischen Wort
„almenningr“, was so viel wie „was jedem gehört“ bedeutet https://de.wikipedia.org/wiki/Allmende
Bye
Hi,
I see the following benefit of superintelligence
as a pair programming model over some internet
community. This is based of my experience
over the last weeks:
- Benefit of Superintelligence:
The superintelligence might not be the design
lead that carries the main idea and makes the
important decisions. Still ChatGPT, DeepSeek, etc..
are exceptionally useful as RTFM slaves.
- Drawback I of Community:
Human communities are execeptionally bad at RTFM,
as the case of Julio the Nazi Retard shows.
He was even not able to organize a copy of the
ISO core standard document.
- Dawback II of Community:
Human communities tend to become vanity churches,
where everybody can leave a mark, even when its
a little pile of poo. An excellent example is golangs
short function literals. Miles and miles since 2022,
but no implementation yet:
proposal: spec: short function literals #21498 https://github.com/golang/go/issues/21498#issuecomment-1132271548
Drawback II is used by many big companies, such
as Google, Apple, etc.. The goal of this use of
social media is to act as magnet, and to tweek
SEO, search engine optimization.
Thats the same goal behind SWI-Prolog discourse,
just produce miles and miles of tapestry of
poo pile, doesn't matter. The most important thing
is to attract more and more cows (and flies),
to fill the common land (Almend in German):
Das Wort Allmende stammt aus dem altnordischen Wort
„almenningr“, was so viel wie „was jedem gehört“ bedeutet https://de.wikipedia.org/wiki/Allmende
Bye
Hi,
China tightens the screws: Influencers now
need degrees to speak on finance, health, law
"China has rolled out a new law requiring
influencers to prove their qualifications before
posting about topics like finance, health or law.
While officials call it a fight against misinformation,
critics see it as a blow to online freedom." https://www.livemint.com/news/world/china-tightens-the-screws-influencers-now-need-degrees-to-speak-on-finance-health-law-11761619952479.html
Maybe this will motivate Boris the Loris, and
Julio the Nazi Retard, to take logic more seriously.
Bye
Bye
Mild Shock schrieb:
Hi,
I see the following benefit of superintelligence
as a pair programming model over some internet
community. This is based of my experience
over the last weeks:
- Benefit of Superintelligence:
The superintelligence might not be the design
lead that carries the main idea and makes the
important decisions. Still ChatGPT, DeepSeek, etc..
are exceptionally useful as RTFM slaves.
- Drawback I of Community:
Human communities are execeptionally bad at RTFM,
as the case of Julio the Nazi Retard shows.
He was even not able to organize a copy of the
ISO core standard document.
- Dawback II of Community:
Human communities tend to become vanity churches,
where everybody can leave a mark, even when its
a little pile of poo. An excellent example is golangs
short function literals. Miles and miles since 2022,
but no implementation yet:
proposal: spec: short function literals #21498
https://github.com/golang/go/issues/21498#issuecomment-1132271548
Drawback II is used by many big companies, such
as Google, Apple, etc.. The goal of this use of
social media is to act as magnet, and to tweek
SEO, search engine optimization.
Thats the same goal behind SWI-Prolog discourse,
just produce miles and miles of tapestry of
poo pile, doesn't matter. The most important thing
is to attract more and more cows (and flies),
to fill the common land (Almend in German):
Das Wort Allmende stammt aus dem altnordischen Wort
„almenningr“, was so viel wie „was jedem gehört“ bedeutet
https://de.wikipedia.org/wiki/Allmende
Bye
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,075 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 100:22:47 |
| Calls: | 13,798 |
| Calls today: | 1 |
| Files: | 186,990 |
| D/L today: |
8,316 files (2,338M bytes) |
| Messages: | 2,438,700 |