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 that we managed to conceive nested arrow
functions, next step on the menu is inner if-then-else
or disjunction, like inside a findall/3 or inside
(\+)/1, doing ahead of time compilation (AOT).
That it leads to problems of rational trees was
more a psyop easter egg of mine. Although I am not
yet sure, in the long run the compiler should
be able to handle rational trees, like copy_term/2
can handle them. But before tackling inner
if-then-else, first check the occurence frequency
of then. Do they happen often? Is it worth AOT-ing
them. Then also before tackling inner if-then-else,
does the code use (,)/2, (;)/2 or (->)/2 in
scenarios where it is used for meta programming
i.e. _,_, _;_ or _->_ pattern for deconstruction
or construction. And do these cases fall into
the new arrow viability check adopte to a if-then-else
viability check, or fall they through?
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
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,076 |
| Nodes: | 10 (1 / 9) |
| Uptime: | 81:17:33 |
| Calls: | 13,805 |
| Files: | 186,990 |
| D/L today: |
7,204 files (2,402M bytes) |
| Messages: | 2,443,304 |