Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.prolog > #14943
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Newsgroups | comp.lang.prolog |
| Subject | VIP4711: Variadic Predicates and Array Patterns (Was: VIP0909: VibeCore Improvement Proposal [term_singletons]) |
| Date | 2025-10-27 14:40 +0100 |
| Message-ID | <10dnsoe$1mjhc$1@solani.org> (permalink) |
| References | <107cdlv$3ok9q$1@solani.org> |
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
Back to comp.lang.prolog | Previous | Next — Previous in thread | Next in thread | Find similar
VIP0909: VibeCore Improvement Proposal [term_singletons] Mild Shock <janburse@fastmail.fm> - 2025-08-11 11:38 +0200
Dushnik–Miller theorem [1940] (Was: VIP0909: VibeCore Improvement Proposal [term_singletons]) Mild Shock <janburse@fastmail.fm> - 2025-08-11 14:31 +0200
Moore-Naish Algorithm in Prolog (Was: Dushnik–Miller theorem [1940]) Mild Shock <janburse@fastmail.fm> - 2025-08-11 14:44 +0200
Who was Seiiti Huzita (1958) ? (Was: Moore-Naish Algorithm in Prolog) Mild Shock <janburse@fastmail.fm> - 2025-08-11 14:50 +0200
What are the constraints of program sharing (Was: Cheap hybrid binary algorithms) Mild Shock <janburse@fastmail.fm> - 2025-09-27 19:34 +0200
VIP0909: VibeCore Improvement Proposal [Jaffar's Algorithm] Mild Shock <janburse@fastmail.fm> - 2025-09-27 19:26 +0200
Cheap hybrid binary algorithms (Was: VIP0909: VibeCore Improvement Proposal [Jaffar's Algorithm]) Mild Shock <janburse@fastmail.fm> - 2025-09-27 19:28 +0200
VIP4711: Variadic Predicates and Array Patterns (Was: VIP0909: VibeCore Improvement Proposal [term_singletons]) Mild Shock <janburse@fastmail.fm> - 2025-10-27 14:40 +0100
The C# Span and new code instructions (Was: VIP4711: Variadic Predicates and Array Patterns) Mild Shock <janburse@fastmail.fm> - 2025-10-27 14:57 +0100
Superintelligence or community? [The Almend Paradox] (Re: The C# Span and new code instructions) Mild Shock <janburse@fastmail.fm> - 2025-10-27 15:16 +0100
No more Almend Paradox [China has enough] (Was: Superintelligence or community? [The Almend Paradox]) Mild Shock <janburse@fastmail.fm> - 2025-10-28 13:54 +0100
No more Almend Paradox [China has enough] (Was: Superintelligence or community? [The Almend Paradox]) Mild Shock <janburse@fastmail.fm> - 2025-10-28 13:57 +0100
Communities betrayed by GitHub [The Matrix is booting] (Was: No more Almend Paradox [China has enough]) Mild Shock <janburse@fastmail.fm> - 2025-10-28 21:06 +0100
Dogzilla: Arrow Functions can be Super Dicts (Was: VIP0909: VibeCore Improvement Proposal [term_singletons]) Mild Shock <janburse@fastmail.fm> - 2025-11-02 15:50 +0100
Dogzilla: Compilation gives First Argument Indexing (Was: Dogzilla: Arrow Functions can be Super Dicts) Mild Shock <janburse@fastmail.fm> - 2025-11-02 15:58 +0100
Dogzilla: History of Dicts in Theorem Provers (Was: Dogzilla: Compilation gives First Argument Indexing) Mild Shock <janburse@fastmail.fm> - 2025-11-02 16:28 +0100
Dogzilla: From Bryan Ford to Lars Hupel (Compilation gives First Argument Indexing) Mild Shock <janburse@fastmail.fm> - 2025-11-02 16:41 +0100
Dogzilla: Set-Like via Clark Completion (Was: Dogzilla: From Bryan Ford to Lars Hupel) Mild Shock <janburse@fastmail.fm> - 2025-11-02 19:47 +0100
AOT Compiled Inner if-then-else (Was: VIP0909: VibeCore Improvement Proposal [term_singletons]) Mild Shock <janburse@fastmail.fm> - 2025-11-05 20:23 +0100
Credits to Hiord: A Type-Free Higher-Order (2004) (Was: AOT Compiled Inner if-then-else) Mild Shock <janburse@fastmail.fm> - 2025-11-05 21:19 +0100
csiph-web