Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.prolog > #14527
| From | Mild Shock <janburse@fastmail.fm> |
|---|---|
| Newsgroups | comp.lang.prolog |
| Subject | the desease of C code overkill (Was: variable ordering guarantees in term_singletons/2) |
| Date | 2025-05-28 16:12 +0200 |
| Message-ID | <10175l3$2k2r$1@solani.org> (permalink) |
| References | (1 earlier) <virvig$raf2$1@solani.org> <vis014$raku$1@solani.org> <vis06a$rapp$1@solani.org> <100uhte$8rfn$1@solani.org> <100uigj$aeol$1@solani.org> |
I don't understand why some Prolog systems tend to gravitate more and more into implementing everything in C. I don't see any advantage. Take listing/1, do you get clauses faster and better printed when you use C? Starting with the pretty/1 implementation in Prolog itself I am pretty sure things can be enhanced. Similarly a top level written in pure Prolog can be advantageous. SWI-Prolog has a similar deseases of C code overkill sometimes. The only argument for C is maybe a different datastructure for variable_names. But the algorthm I posted on comp.lang.prolog doesn't need a different datastructures, its just a pairing algorithm. Running through both the term_variables and term_singleton lists in parallel. So there is no advantage of C code at all. Mild Shock schrieb: > Hi, > > People from Vienna were always a little strange. > Why not adopt term_singletons/2 its already around > for a while. You can do quite some magic with it. > > Example: Determining singletons during listing, > from Dogelog Player library(tester/tools): > > % sys_listing_write(+Term, +Stream) > sys_listing_write(C, T) :- > term_variables(C, V), > term_singletons(C, A), > sys_listing_names(V, A, 0, N), > write_term(T, C, [quoted(true), variable_names(N), format(true)]), > sys_answer_period(T). > > If term_singletons/2 has the same variable ordering > guarantees, i.e. left to right, as in term_variables/2 > you can use an algorithm without expensive lookup, > > sys_listing_names([], _, _, []). > sys_listing_names([X|L], [Y|R], K, ['_'=X|S]) :- X==Y, !, > sys_listing_names(L, R, K, S). > sys_listing_names([X|L], A, K, [N=X|R]) :- > sys_listing_name(K, N), > J is K+1, > sys_listing_names(L, A, J, R). > > Just run along the two lists , if something is both in > the term_variables/2 and term_singletons/2 list, generate > a '_' name, otherwise generate a synthetic name. > > Bye > > Mild Shock schrieb: >> Hi, >> >> The development of Trealla Prolog and Scryer Prolog >> looks like a random search in a mental ocean. >> >> It is like Prolog Development à la Sigmund Freud, >> you have only to dig deep enough, and a solution >> >> will pop up. Otherwise blame your mother or other >> relatives that raised you for supression. >> >> LoL >> >> Bye >> >> Examples: Still clueless how to detect singletons? >> https://github.com/trealla-prolog/trealla/issues/743
Back to comp.lang.prolog | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Ulrich Neumerkel is like Ozzy Osbourne Mild Shock <janburse@fastmail.fm> - 2024-12-05 11:26 +0100
Re: Ulrich Neumerkel is like Ozzy Osbourne Mild Shock <janburse@fastmail.fm> - 2024-12-05 11:33 +0100
Re: Ulrich Neumerkel is like Ozzy Osbourne Mild Shock <janburse@fastmail.fm> - 2024-12-05 11:41 +0100
Re: Ulrich Neumerkel is like Ozzy Osbourne Mild Shock <janburse@fastmail.fm> - 2024-12-05 11:44 +0100
Prolog Development à la Sigmund Freud (Was: Ulrich Neumerkel is like Ozzy Osbourne) Mild Shock <janburse@fastmail.fm> - 2025-05-25 09:46 +0200
variable ordering guarantees in term_singletons/2 (Was: Prolog Development à la Sigmund Freud) Mild Shock <janburse@fastmail.fm> - 2025-05-25 09:57 +0200
My stupid Dogelog Player falls back to _<number> (Was: variable ordering guarantees in term_singletons/2) Mild Shock <janburse@fastmail.fm> - 2025-05-25 10:18 +0200
the desease of C code overkill (Was: variable ordering guarantees in term_singletons/2) Mild Shock <janburse@fastmail.fm> - 2025-05-28 16:12 +0200
Quintus Folks were not hating Prolog that much (Was: the desease of C code overkill) Mild Shock <janburse@fastmail.fm> - 2025-05-28 16:32 +0200
Ciao Prolog inspired Test Case (Re: Ulrich Neumerkel is like Ozzy Osbourne) Mild Shock <janburse@fastmail.fm> - 2025-05-27 07:45 +0200
csiph-web