Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

I've looked at the listing, and it's right! -- Joel Halpern


devel / comp.lang.prolog / More best kept secrets of Prolog: Pattern Matching

SubjectAuthor
* More best kept secrets of Prolog: Pattern MatchingMostowski Collapse
+* Re: More best kept secrets of Prolog: Pattern MatchingJulio Di Egidio
|+- Re: More best kept secrets of Prolog: Pattern MatchingJulio Di Egidio
|+* Re: More best kept secrets of Prolog: Pattern MatchingMostowski Collapse
||`* Re: More best kept secrets of Prolog: Pattern MatchingMostowski Collapse
|| `- Re: More best kept secrets of Prolog: Pattern MatchingMostowski Collapse
|`* Re: More best kept secrets of Prolog: Pattern MatchingJulio Di Egidio
| `* Re: More best kept secrets of Prolog: Pattern MatchingMostowski Collapse
|  +- Re: More best kept secrets of Prolog: Pattern MatchingMostowski Collapse
|  `* Re: More best kept secrets of Prolog: Pattern MatchingJulio Di Egidio
|   `* Re: More best kept secrets of Prolog: Pattern MatchingMostowski Collapse
|    `* Re: More best kept secrets of Prolog: Pattern MatchingMostowski Collapse
|     `* Re: More best kept secrets of Prolog: Pattern MatchingMostowski Collapse
|      `* Re: More best kept secrets of Prolog: Pattern MatchingMostowski Collapse
|       `* Re: More best kept secrets of Prolog: Pattern MatchingMostowski Collapse
|        `- Re: More best kept secrets of Prolog: Pattern MatchingMostowski Collapse
`* Re: More best kept secrets of Prolog: Pattern MatchingMostowski Collapse
 `- Re: More best kept secrets of Prolog: Pattern MatchingMostowski Collapse

1
More best kept secrets of Prolog: Pattern Matching

<sgqqbp$n1h$1@solani.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=846&group=comp.lang.prolog#846

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janburse@fastmail.fm (Mostowski Collapse)
Newsgroups: comp.lang.prolog
Subject: More best kept secrets of Prolog: Pattern Matching
Date: Thu, 2 Sep 2021 17:24:41 +0200
Message-ID: <sgqqbp$n1h$1@solani.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 2 Sep 2021 15:24:41 -0000 (UTC)
Injection-Info: solani.org;
logging-data="23601"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101
Firefox/60.0 SeaMonkey/2.53.9
X-User-ID: eJwFwYEBwDAEBMCVqniME+L3HyF3rhBMGBzmdGauJH4y2iTdqgO3R8ZDTzSWqpFVAvbJLo7sbapYzFfcB09gFeo=
Cancel-Lock: sha1:EC0pgGIb31FWLENe0CejGFKJ12o=
X-Mozilla-News-Host: news://news.solani.org:119
 by: Mostowski Collapse - Thu, 2 Sep 2021 15:24 UTC

Everybody loves pattern matching. Languages
like Python, release 3.10, even provide it
now. There is now a match/case statement

in Python. But Prolog users will scratch their
head. Will my if-then-else be as fast as a
imperative switch jump table lookup?

Dogelog runtime has stepped up its game
concerning pattern matching. It now provides
ECLiPSe Prolog disjunction and if-then-else

indexing. Take this example:

?- [user].
foo(X,Y) :- X=baz, Y=2; X=bar -> Y=1.

SWI-Prolog leaves a choice point, so no
clause indexing used:

/* SWI-Prolog 8.3.26 */
?- foo(baz,Z).
Z = 2 ; %%% Spurious Choice Point
false.

Dogelog doesn't leave a choice point, since
it can index the disjunction and if-then-else:

/* Dogelog Runtime 0.9.3 */
?- foo(baz,Z).
Z = 2. %%% No Choice Point

See also:

Preview: Dogelog disjunction and if-then-else indexing. (Jekejeke)
https://twitter.com/dogelogch/status/1433446729974796293

Preview: Dogelog disjunction and if-then-else indexing. (Jekejeke)
https://www.facebook.com/groups/dogelog

Re: More best kept secrets of Prolog: Pattern Matching

<01d2b75a-b769-4e5a-b6cd-d463a09751f2n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=847&group=comp.lang.prolog#847

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a0c:d412:: with SMTP id t18mr2945736qvh.53.1630666632173;
Fri, 03 Sep 2021 03:57:12 -0700 (PDT)
X-Received: by 2002:a25:8003:: with SMTP id m3mr3958275ybk.138.1630666631934;
Fri, 03 Sep 2021 03:57:11 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 3 Sep 2021 03:57:11 -0700 (PDT)
In-Reply-To: <sgqqbp$n1h$1@solani.org>
Injection-Info: google-groups.googlegroups.com; posting-host=93.41.98.252; posting-account=F3H0JAgAAADcYVukktnHx7hFG5stjWse
NNTP-Posting-Host: 93.41.98.252
References: <sgqqbp$n1h$1@solani.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <01d2b75a-b769-4e5a-b6cd-d463a09751f2n@googlegroups.com>
Subject: Re: More best kept secrets of Prolog: Pattern Matching
From: julio@diegidio.name (Julio Di Egidio)
Injection-Date: Fri, 03 Sep 2021 10:57:12 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 65
 by: Julio Di Egidio - Fri, 3 Sep 2021 10:57 UTC

On Thursday, 2 September 2021 at 17:24:43 UTC+2, burs...@gmail.com wrote:
<snip>
> Dogelog runtime has stepped up its game
> concerning pattern matching. It now provides
> ECLiPSe Prolog disjunction and if-then-else
>
> indexing. Take this example:
>
> ?- [user].
> foo(X,Y) :- X=baz, Y=2; X=bar -> Y=1.
>
> SWI-Prolog leaves a choice point, so no
> clause indexing used:
>
> /* SWI-Prolog 8.3.26 */
> ?- foo(baz,Z).
> Z = 2 ; %%% Spurious Choice Point
> false.
>
> Dogelog doesn't leave a choice point, since
> it can index the disjunction and if-then-else:

I think it's unfair to call it spurious, it's you who are doing something extra-ordinary.

And something that may not always be desirable: that optimisation disallows the easy/clean way to keep the choice point should one want to, which is with code as above vs using constants directly as head arguments. (And as seen in the example below.)

Use cases for precise control of language features? Didactics and research spring to mind, and even more should certified software, also scenarios like coordinating concurrency, etc., there may be more. Anyway, clause indexing changes the semantics of programs. Just consider this:

```
% SWI-Prolog 8.2.0

?- retractall(f(_)).
true.
?- assertz(f(X) :- X = 1), assertz(f(X) :- X = 2).
true.
?- X = 1, call_cleanup(f(X), Det=yes).
X = 1 ;
false.

?- retractall(f(_)).
true.
?- assertz(f(1)), assertz(f(2)).
true.
?- X = 1, call_cleanup(f(X), Det=yes).
X = 1,
Det = yes.

```

Along that line, I'd rather wish we could attribute predicates to have control on indexing (maybe just an extension to meta_predicate/1, it's simply an indexing option per argument, whether to index it or not, or even, in more sophisticated implementations, up to which nested level to index: 0 for the head, 1 for the body, 2 for a body goal's body, etc. In that scheme, your current implementation is like indexing on all arguments at level 1), sure possibly with reasonable defaults: then it'd be all good, including the extra-ordinary...

Julio

Re: More best kept secrets of Prolog: Pattern Matching

<d577e7c8-0aa8-432c-a074-45315dada6e4n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=848&group=comp.lang.prolog#848

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:81d:: with SMTP id s29mr3038204qks.301.1630670747753;
Fri, 03 Sep 2021 05:05:47 -0700 (PDT)
X-Received: by 2002:a25:810c:: with SMTP id o12mr4812077ybk.250.1630670747576;
Fri, 03 Sep 2021 05:05:47 -0700 (PDT)
Path: i2pn2.org!rocksolid2!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 3 Sep 2021 05:05:47 -0700 (PDT)
In-Reply-To: <01d2b75a-b769-4e5a-b6cd-d463a09751f2n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=93.41.98.252; posting-account=F3H0JAgAAADcYVukktnHx7hFG5stjWse
NNTP-Posting-Host: 93.41.98.252
References: <sgqqbp$n1h$1@solani.org> <01d2b75a-b769-4e5a-b6cd-d463a09751f2n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d577e7c8-0aa8-432c-a074-45315dada6e4n@googlegroups.com>
Subject: Re: More best kept secrets of Prolog: Pattern Matching
From: julio@diegidio.name (Julio Di Egidio)
Injection-Date: Fri, 03 Sep 2021 12:05:47 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 15
 by: Julio Di Egidio - Fri, 3 Sep 2021 12:05 UTC

On Friday, 3 September 2021 at 12:57:12 UTC+2, Julio Di Egidio wrote:
> On Thursday, 2 September 2021 at 17:24:43 UTC+2, burs...@gmail.com wrote:

> In that scheme, your current implementation is like indexing on all arguments at level 1

....with special provision for goals matching 'if', where you go down into the premise... (If that's in fact what you do.)

If's are special, but all if's (well, I am not actually sure about the soft-cuts) boil down to cuts, and I don't think cuts add substantial complication to the scheme I have drafted: I should think more about it, but my first guess is that cuts could simply be ignored.

Julio

Re: More best kept secrets of Prolog: Pattern Matching

<e4e80ed8-afe1-4e11-931c-7b9e88fd3070n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=849&group=comp.lang.prolog#849

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a37:67d7:: with SMTP id b206mr3245926qkc.395.1630675127927;
Fri, 03 Sep 2021 06:18:47 -0700 (PDT)
X-Received: by 2002:a25:b941:: with SMTP id s1mr4683109ybm.304.1630675127622;
Fri, 03 Sep 2021 06:18:47 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 3 Sep 2021 06:18:47 -0700 (PDT)
In-Reply-To: <01d2b75a-b769-4e5a-b6cd-d463a09751f2n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sgqqbp$n1h$1@solani.org> <01d2b75a-b769-4e5a-b6cd-d463a09751f2n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e4e80ed8-afe1-4e11-931c-7b9e88fd3070n@googlegroups.com>
Subject: Re: More best kept secrets of Prolog: Pattern Matching
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Fri, 03 Sep 2021 13:18:47 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 40
 by: Mostowski Collapse - Fri, 3 Sep 2021 13:18 UTC

Try SWI-Prolog 8.3.xx something, this test case:

f(X) :- X = 1.
f(X) :- X = 2.

?- f(1).
%%% what do you see here, with devel SWI-Prolog?

Will not anymore leave a spurious choice point.
I had this in Jekejeke Prolog. It got then adopted by
SWI-Prolog. And I added it to Dogelog runtime this week.

Jekejeke Prolog: (Inofficial future DNS pages.jekejeke.ch, not yet announce)
Body Indexing
http://pages.jekejeke.ch/doctab/doclet/en/docs/05_run/02_reference/07_theories/01_kernel/06_sharing.html

SWI-Prolog:
Indexing for body code
https://www.swi-prolog.org/pldoc/man?section=indexbody

Dogelog runtime:
Preview: Dogelog Runtime does clause body indexing. (Jekejeke)
https://twitter.com/dogelogch/status/1433235977955430400

Having clause body indexing is prerequesite to having
disjunction and if-then-else indexing in Dogelog runtime.
So possibly you find clause body indexing also

in ECLiPSe Prolog which has disjunction and if-then-else indexing.

ju...@diegidio.name schrieb am Freitag, 3. September 2021 um 12:57:12 UTC+2:
> ```
> % SWI-Prolog 8.2.0
>
> ?- retractall(f(_)).
> true.
> ?- assertz(f(X) :- X = 1), assertz(f(X) :- X = 2).
> true.
> ?- X = 1, call_cleanup(f(X), Det=yes).
> X = 1 ;
> false.

Re: More best kept secrets of Prolog: Pattern Matching

<29b2f39a-085a-4771-89cd-27d1e6fe659en@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=850&group=comp.lang.prolog#850

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a37:9586:: with SMTP id x128mr3463825qkd.49.1630675655348;
Fri, 03 Sep 2021 06:27:35 -0700 (PDT)
X-Received: by 2002:a25:644:: with SMTP id 65mr4710413ybg.300.1630675654876;
Fri, 03 Sep 2021 06:27:34 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 3 Sep 2021 06:27:34 -0700 (PDT)
In-Reply-To: <e4e80ed8-afe1-4e11-931c-7b9e88fd3070n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sgqqbp$n1h$1@solani.org> <01d2b75a-b769-4e5a-b6cd-d463a09751f2n@googlegroups.com>
<e4e80ed8-afe1-4e11-931c-7b9e88fd3070n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <29b2f39a-085a-4771-89cd-27d1e6fe659en@googlegroups.com>
Subject: Re: More best kept secrets of Prolog: Pattern Matching
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Fri, 03 Sep 2021 13:27:35 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 68
 by: Mostowski Collapse - Fri, 3 Sep 2021 13:27 UTC

What is novel in the Dogelog runtime, you somehow have
full control on how the index key is computed. Since Dogelog
runtime itself is written in Prolog itself, assertz/1 and ensure_loaded/1

are also written in Prolog itself. It was not clear that some of
the index key computation can in fact be "out sourced" into
Prolog itself. But somehow I managed to do that, for the simple

scenario of first argument indexing. Currently the index key
computation for a clause is seen here:

- index_clause(R, O):
The predicate succeeds in O with the indexing value of the clause with head R.
- index_static(R, L, O):
The predicate succeeds in O with the indexing value of the clause with head R and body L.

https://gist.github.com/jburse/d10ac03547a9d59b858c2ef2342e488b#file-index-pl

You find it also on GitHub in compile.p:

https://github.com/jburse/dogelog-moon/tree/main/devel/transpiler

index_clause/2 is the classical first argument index key.
index_static/3 implements a very simple clause body index key.
As you see it has an additional parameter, you need to

pass the body as well, since it is clause **body** indexing.

Mostowski Collapse schrieb am Freitag, 3. September 2021 um 15:18:48 UTC+2:
> Try SWI-Prolog 8.3.xx something, this test case:
>
> f(X) :- X = 1.
> f(X) :- X = 2.
>
> ?- f(1).
> %%% what do you see here, with devel SWI-Prolog?
>
> Will not anymore leave a spurious choice point.
> I had this in Jekejeke Prolog. It got then adopted by
> SWI-Prolog. And I added it to Dogelog runtime this week.
>
> Jekejeke Prolog: (Inofficial future DNS pages.jekejeke.ch, not yet announce)
> Body Indexing
> http://pages.jekejeke.ch/doctab/doclet/en/docs/05_run/02_reference/07_theories/01_kernel/06_sharing.html
>
> SWI-Prolog:
> Indexing for body code
> https://www.swi-prolog.org/pldoc/man?section=indexbody
>
> Dogelog runtime:
> Preview: Dogelog Runtime does clause body indexing. (Jekejeke)
> https://twitter.com/dogelogch/status/1433235977955430400
>
> Having clause body indexing is prerequesite to having
> disjunction and if-then-else indexing in Dogelog runtime.
> So possibly you find clause body indexing also
>
> in ECLiPSe Prolog which has disjunction and if-then-else indexing.
> ju...@diegidio.name schrieb am Freitag, 3. September 2021 um 12:57:12 UTC+2:
> > ```
> > % SWI-Prolog 8.2.0
> >
> > ?- retractall(f(_)).
> > true.
> > ?- assertz(f(X) :- X = 1), assertz(f(X) :- X = 2).
> > true.
> > ?- X = 1, call_cleanup(f(X), Det=yes).
> > X = 1 ;
> > false.

Re: More best kept secrets of Prolog: Pattern Matching

<cd8421ba-dcba-4cc4-8bcf-aca279f1c004n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=852&group=comp.lang.prolog#852

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:2297:: with SMTP id o23mr3440873qkh.405.1630676011315;
Fri, 03 Sep 2021 06:33:31 -0700 (PDT)
X-Received: by 2002:a5b:345:: with SMTP id q5mr4544165ybp.320.1630676011136;
Fri, 03 Sep 2021 06:33:31 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 3 Sep 2021 06:33:30 -0700 (PDT)
In-Reply-To: <29b2f39a-085a-4771-89cd-27d1e6fe659en@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sgqqbp$n1h$1@solani.org> <01d2b75a-b769-4e5a-b6cd-d463a09751f2n@googlegroups.com>
<e4e80ed8-afe1-4e11-931c-7b9e88fd3070n@googlegroups.com> <29b2f39a-085a-4771-89cd-27d1e6fe659en@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cd8421ba-dcba-4cc4-8bcf-aca279f1c004n@googlegroups.com>
Subject: Re: More best kept secrets of Prolog: Pattern Matching
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Fri, 03 Sep 2021 13:33:31 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 78
 by: Mostowski Collapse - Fri, 3 Sep 2021 13:33 UTC

But I rather refrain from doing something with meta_predicate/1,
to have manual control over indexes. Some current wish of mine
is to bring a) just-in-time indexing to Dogelog runtime and

b) multi-argument indexing to Dogelog runtime. a) and b) do
both exist in Jekejeke Prolog, the question is currently how to
bring it to Dogelog runtime. I have opened a couple of GitHub

tickets for Dogelog runtime, to take notes of some ideas to do it.

Mostowski Collapse schrieb am Freitag, 3. September 2021 um 15:27:36 UTC+2:
> What is novel in the Dogelog runtime, you somehow have
> full control on how the index key is computed. Since Dogelog
> runtime itself is written in Prolog itself, assertz/1 and ensure_loaded/1
>
> are also written in Prolog itself. It was not clear that some of
> the index key computation can in fact be "out sourced" into
> Prolog itself. But somehow I managed to do that, for the simple
>
> scenario of first argument indexing. Currently the index key
> computation for a clause is seen here:
>
> - index_clause(R, O):
> The predicate succeeds in O with the indexing value of the clause with head R.
> - index_static(R, L, O):
> The predicate succeeds in O with the indexing value of the clause with head R and body L.
>
> https://gist.github.com/jburse/d10ac03547a9d59b858c2ef2342e488b#file-index-pl
>
> You find it also on GitHub in compile.p:
>
> https://github.com/jburse/dogelog-moon/tree/main/devel/transpiler
>
> index_clause/2 is the classical first argument index key.
> index_static/3 implements a very simple clause body index key.
> As you see it has an additional parameter, you need to
>
> pass the body as well, since it is clause **body** indexing.
> Mostowski Collapse schrieb am Freitag, 3. September 2021 um 15:18:48 UTC+2:
> > Try SWI-Prolog 8.3.xx something, this test case:
> >
> > f(X) :- X = 1.
> > f(X) :- X = 2.
> >
> > ?- f(1).
> > %%% what do you see here, with devel SWI-Prolog?
> >
> > Will not anymore leave a spurious choice point.
> > I had this in Jekejeke Prolog. It got then adopted by
> > SWI-Prolog. And I added it to Dogelog runtime this week.
> >
> > Jekejeke Prolog: (Inofficial future DNS pages.jekejeke.ch, not yet announce)
> > Body Indexing
> > http://pages.jekejeke.ch/doctab/doclet/en/docs/05_run/02_reference/07_theories/01_kernel/06_sharing.html
> >
> > SWI-Prolog:
> > Indexing for body code
> > https://www.swi-prolog.org/pldoc/man?section=indexbody
> >
> > Dogelog runtime:
> > Preview: Dogelog Runtime does clause body indexing. (Jekejeke)
> > https://twitter.com/dogelogch/status/1433235977955430400
> >
> > Having clause body indexing is prerequesite to having
> > disjunction and if-then-else indexing in Dogelog runtime.
> > So possibly you find clause body indexing also
> >
> > in ECLiPSe Prolog which has disjunction and if-then-else indexing.
> > ju...@diegidio.name schrieb am Freitag, 3. September 2021 um 12:57:12 UTC+2:
> > > ```
> > > % SWI-Prolog 8.2.0
> > >
> > > ?- retractall(f(_)).
> > > true.
> > > ?- assertz(f(X) :- X = 1), assertz(f(X) :- X = 2).
> > > true.
> > > ?- X = 1, call_cleanup(f(X), Det=yes).
> > > X = 1 ;
> > > false.

Re: More best kept secrets of Prolog: Pattern Matching

<b83745b7-4156-4c42-a5b9-29d9a7ec4d07n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=856&group=comp.lang.prolog#856

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:5b8d:: with SMTP id a13mr4106349qta.130.1630679658903;
Fri, 03 Sep 2021 07:34:18 -0700 (PDT)
X-Received: by 2002:a25:b941:: with SMTP id s1mr5115212ybm.304.1630679658718;
Fri, 03 Sep 2021 07:34:18 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 3 Sep 2021 07:34:18 -0700 (PDT)
In-Reply-To: <01d2b75a-b769-4e5a-b6cd-d463a09751f2n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=93.41.98.252; posting-account=F3H0JAgAAADcYVukktnHx7hFG5stjWse
NNTP-Posting-Host: 93.41.98.252
References: <sgqqbp$n1h$1@solani.org> <01d2b75a-b769-4e5a-b6cd-d463a09751f2n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b83745b7-4156-4c42-a5b9-29d9a7ec4d07n@googlegroups.com>
Subject: Re: More best kept secrets of Prolog: Pattern Matching
From: julio@diegidio.name (Julio Di Egidio)
Injection-Date: Fri, 03 Sep 2021 14:34:18 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 67
 by: Julio Di Egidio - Fri, 3 Sep 2021 14:34 UTC

On Friday, 3 September 2021 at 12:57:12 UTC+2, Julio Di Egidio wrote:
> On Thursday, 2 September 2021 at 17:24:43 UTC+2, burs...@gmail.com wrote:
<snip>
> > Dogelog doesn't leave a choice point, since
> > it can index the disjunction and if-then-else:
> I think it's unfair to call it spurious, it's you who are doing something extra-ordinary.
>
> And something that may not always be desirable: that optimisation disallows the easy/clean way to keep the choice point should one want to, which is with code as above vs using constants directly as head arguments. (And as seen in the example below.)
>
> Use cases for precise control of language features? Didactics and research spring to mind, and even more should certified software, also scenarios like coordinating concurrency, etc., there may be more. Anyway, clause indexing changes the semantics of programs. Just consider this:
>
> ```
> % SWI-Prolog 8.2.0
>
> ?- retractall(f(_)).
> true.
> ?- assertz(f(X) :- X = 1), assertz(f(X) :- X = 2).
> true.
> ?- X = 1, call_cleanup(f(X), Det=yes).
> X = 1 ;
> false.
>
> ?- retractall(f(_)).
> true.
> ?- assertz(f(1)), assertz(f(2)).
> true.
> ?- X = 1, call_cleanup(f(X), Det=yes).
> X = 1,
> Det = yes.
>
> ```
>
> Along that line, I'd rather wish we could attribute predicates to have control on indexing (maybe just an extension to meta_predicate/1, it's simply an indexing option per argument, whether to index it or not, or even, in more sophisticated implementations, up to which nested level to index: 0 for the head, 1 for the body, 2 for a body goal's body, etc. In that scheme, your current implementation is like indexing on all arguments at level 1), sure possibly with reasonable defaults: then it'd be all good, including the extra-ordinary...

Or, just max depth for max speed-up and we rather set whether to simulate "pure" determinism on that argument or not...?

Anyway, I'd argue the use case is quite important, even strategic re the state of Prolog (and this is about Prolog itself, not -say- constraint programming or some other thing). Moreover, given that you are right now getting into (re)building this part for Dogelog, this might actually be the perfect moment to ponder if something better and more uniform than the obvious could be done, in fact for even less effort.

I am partly speculating as I haven't seen the source code. If things are relatively clean/properly structured, this more "experimental" stuff could even be done in parallel (and with no particular hurry), while the main branch keeps using the usual implementations, to eventually possibly be swept in...

Are you open to collaborations, up to pull requests, for Dogelog?

Julio

Re: More best kept secrets of Prolog: Pattern Matching

<a0d7d89c-685d-429a-be2a-c92332bcb91fn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=857&group=comp.lang.prolog#857

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:67d7:: with SMTP id r23mr4394805qtp.227.1630684167862;
Fri, 03 Sep 2021 08:49:27 -0700 (PDT)
X-Received: by 2002:a25:5808:: with SMTP id m8mr5979340ybb.334.1630684167684;
Fri, 03 Sep 2021 08:49:27 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 3 Sep 2021 08:49:27 -0700 (PDT)
In-Reply-To: <b83745b7-4156-4c42-a5b9-29d9a7ec4d07n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sgqqbp$n1h$1@solani.org> <01d2b75a-b769-4e5a-b6cd-d463a09751f2n@googlegroups.com>
<b83745b7-4156-4c42-a5b9-29d9a7ec4d07n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a0d7d89c-685d-429a-be2a-c92332bcb91fn@googlegroups.com>
Subject: Re: More best kept secrets of Prolog: Pattern Matching
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Fri, 03 Sep 2021 15:49:27 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 9
 by: Mostowski Collapse - Fri, 3 Sep 2021 15:49 UTC

It was always open source:

Open Source: Dogelog Runtime
https://github.com/jburse/dogelog-moon/tree/main/devel

User Manual: Dogelog Runtime
https://github.com/jburse/dogelog-moon/tree/main/manual

ju...@diegidio.name schrieb am Freitag, 3. September 2021 um 16:34:19 UTC+2:
> I am partly speculating as I haven't seen the source code.

Re: More best kept secrets of Prolog: Pattern Matching

<e89b3613-0b88-498f-b49e-f23d3f16e996n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=858&group=comp.lang.prolog#858

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a37:ea16:: with SMTP id t22mr1360165qkj.507.1630684711572;
Fri, 03 Sep 2021 08:58:31 -0700 (PDT)
X-Received: by 2002:a25:2209:: with SMTP id i9mr5732430ybi.146.1630684711347;
Fri, 03 Sep 2021 08:58:31 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 3 Sep 2021 08:58:31 -0700 (PDT)
In-Reply-To: <a0d7d89c-685d-429a-be2a-c92332bcb91fn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sgqqbp$n1h$1@solani.org> <01d2b75a-b769-4e5a-b6cd-d463a09751f2n@googlegroups.com>
<b83745b7-4156-4c42-a5b9-29d9a7ec4d07n@googlegroups.com> <a0d7d89c-685d-429a-be2a-c92332bcb91fn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e89b3613-0b88-498f-b49e-f23d3f16e996n@googlegroups.com>
Subject: Re: More best kept secrets of Prolog: Pattern Matching
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Fri, 03 Sep 2021 15:58:31 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mostowski Collapse - Fri, 3 Sep 2021 15:58 UTC

Issues can be raised here on GitHub:

Issue Tracking: Dogelog Runtime
https://github.com/jburse/dogelog-moon/issues

Mostowski Collapse schrieb am Freitag, 3. September 2021 um 17:49:28 UTC+2:
> It was always open source:
>
> Open Source: Dogelog Runtime
> https://github.com/jburse/dogelog-moon/tree/main/devel
>
> User Manual: Dogelog Runtime
> https://github.com/jburse/dogelog-moon/tree/main/manual
> ju...@diegidio.name schrieb am Freitag, 3. September 2021 um 16:34:19 UTC+2:
> > I am partly speculating as I haven't seen the source code.

Re: More best kept secrets of Prolog: Pattern Matching

<3d736c26-a38b-4d6d-9a27-12177bb242d0n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=859&group=comp.lang.prolog#859

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a37:a883:: with SMTP id r125mr4088370qke.408.1630686402970;
Fri, 03 Sep 2021 09:26:42 -0700 (PDT)
X-Received: by 2002:a25:5808:: with SMTP id m8mr6193987ybb.334.1630686402778;
Fri, 03 Sep 2021 09:26:42 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 3 Sep 2021 09:26:42 -0700 (PDT)
In-Reply-To: <a0d7d89c-685d-429a-be2a-c92332bcb91fn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=93.41.98.252; posting-account=F3H0JAgAAADcYVukktnHx7hFG5stjWse
NNTP-Posting-Host: 93.41.98.252
References: <sgqqbp$n1h$1@solani.org> <01d2b75a-b769-4e5a-b6cd-d463a09751f2n@googlegroups.com>
<b83745b7-4156-4c42-a5b9-29d9a7ec4d07n@googlegroups.com> <a0d7d89c-685d-429a-be2a-c92332bcb91fn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3d736c26-a38b-4d6d-9a27-12177bb242d0n@googlegroups.com>
Subject: Re: More best kept secrets of Prolog: Pattern Matching
From: julio@diegidio.name (Julio Di Egidio)
Injection-Date: Fri, 03 Sep 2021 16:26:42 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 6
 by: Julio Di Egidio - Fri, 3 Sep 2021 16:26 UTC

On Friday, 3 September 2021 at 17:49:28 UTC+2, burs...@gmail.com wrote:

> It was always open source:

That's not what I was asking, open source isn't the same as open project...

Julio

Re: More best kept secrets of Prolog: Pattern Matching

<6cca4112-6dcf-433e-8f00-4e4920450027n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=860&group=comp.lang.prolog#860

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ad4:5a06:: with SMTP id ei6mr370067qvb.21.1630692856170;
Fri, 03 Sep 2021 11:14:16 -0700 (PDT)
X-Received: by 2002:a25:b941:: with SMTP id s1mr456194ybm.304.1630692855938;
Fri, 03 Sep 2021 11:14:15 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 3 Sep 2021 11:14:15 -0700 (PDT)
In-Reply-To: <3d736c26-a38b-4d6d-9a27-12177bb242d0n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sgqqbp$n1h$1@solani.org> <01d2b75a-b769-4e5a-b6cd-d463a09751f2n@googlegroups.com>
<b83745b7-4156-4c42-a5b9-29d9a7ec4d07n@googlegroups.com> <a0d7d89c-685d-429a-be2a-c92332bcb91fn@googlegroups.com>
<3d736c26-a38b-4d6d-9a27-12177bb242d0n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6cca4112-6dcf-433e-8f00-4e4920450027n@googlegroups.com>
Subject: Re: More best kept secrets of Prolog: Pattern Matching
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Fri, 03 Sep 2021 18:14:16 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 21
 by: Mostowski Collapse - Fri, 3 Sep 2021 18:14 UTC

You can raise an issue here when you think there
is something wrong with Dogelog license:

Issue Tracking: Dogelog Runtime
https://github.com/jburse/dogelog-moon/issues

Basically it has an elongated open source license.
This means it has a copyright license that makes
the source code available with a product, but it

also covers usage in a lunar environment, or
even in the milky way. Thats why its full name is:

Dogelog Runtime, Prolog to the Moon

ju...@diegidio.name schrieb am Freitag, 3. September 2021 um 18:26:43 UTC+2:
> On Friday, 3 September 2021 at 17:49:28 UTC+2, burs...@gmail.com wrote:
>
> > It was always open source:
> That's not what I was asking, open source isn't the same as open project...
>
> Julio

Re: More best kept secrets of Prolog: Pattern Matching

<e885dc5a-4376-4de1-ab76-1a215d577ab2n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=861&group=comp.lang.prolog#861

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a0c:fbcf:: with SMTP id n15mr399334qvp.49.1630693498852;
Fri, 03 Sep 2021 11:24:58 -0700 (PDT)
X-Received: by 2002:a25:4ac6:: with SMTP id x189mr428157yba.527.1630693498660;
Fri, 03 Sep 2021 11:24:58 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 3 Sep 2021 11:24:58 -0700 (PDT)
In-Reply-To: <6cca4112-6dcf-433e-8f00-4e4920450027n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sgqqbp$n1h$1@solani.org> <01d2b75a-b769-4e5a-b6cd-d463a09751f2n@googlegroups.com>
<b83745b7-4156-4c42-a5b9-29d9a7ec4d07n@googlegroups.com> <a0d7d89c-685d-429a-be2a-c92332bcb91fn@googlegroups.com>
<3d736c26-a38b-4d6d-9a27-12177bb242d0n@googlegroups.com> <6cca4112-6dcf-433e-8f00-4e4920450027n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e885dc5a-4376-4de1-ab76-1a215d577ab2n@googlegroups.com>
Subject: Re: More best kept secrets of Prolog: Pattern Matching
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Fri, 03 Sep 2021 18:24:58 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 27
 by: Mostowski Collapse - Fri, 3 Sep 2021 18:24 UTC

Dogelog, stupid meme Prolog, total waste of time,

dogecoin.avi
https://www.youtube.com/watch?v=H3oiThw2R

LoL

Mostowski Collapse schrieb am Freitag, 3. September 2021 um 20:14:16 UTC+2:
> You can raise an issue here when you think there
> is something wrong with Dogelog license:
> Issue Tracking: Dogelog Runtime
> https://github.com/jburse/dogelog-moon/issues
> Basically it has an elongated open source license.
> This means it has a copyright license that makes
> the source code available with a product, but it
>
> also covers usage in a lunar environment, or
> even in the milky way. Thats why its full name is:
>
> Dogelog Runtime, Prolog to the Moon
> ju...@diegidio.name schrieb am Freitag, 3. September 2021 um 18:26:43 UTC+2:
> > On Friday, 3 September 2021 at 17:49:28 UTC+2, burs...@gmail.com wrote:
> >
> > > It was always open source:
> > That's not what I was asking, open source isn't the same as open project...
> >
> > Julio

Re: More best kept secrets of Prolog: Pattern Matching

<4fccfac5-d9f6-4b82-b5f7-2a6c81229c18n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=862&group=comp.lang.prolog#862

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:6214:134a:: with SMTP id b10mr455215qvw.67.1630694583202;
Fri, 03 Sep 2021 11:43:03 -0700 (PDT)
X-Received: by 2002:a25:ae64:: with SMTP id g36mr731774ybe.26.1630694582936;
Fri, 03 Sep 2021 11:43:02 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 3 Sep 2021 11:43:02 -0700 (PDT)
In-Reply-To: <e885dc5a-4376-4de1-ab76-1a215d577ab2n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sgqqbp$n1h$1@solani.org> <01d2b75a-b769-4e5a-b6cd-d463a09751f2n@googlegroups.com>
<b83745b7-4156-4c42-a5b9-29d9a7ec4d07n@googlegroups.com> <a0d7d89c-685d-429a-be2a-c92332bcb91fn@googlegroups.com>
<3d736c26-a38b-4d6d-9a27-12177bb242d0n@googlegroups.com> <6cca4112-6dcf-433e-8f00-4e4920450027n@googlegroups.com>
<e885dc5a-4376-4de1-ab76-1a215d577ab2n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4fccfac5-d9f6-4b82-b5f7-2a6c81229c18n@googlegroups.com>
Subject: Re: More best kept secrets of Prolog: Pattern Matching
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Fri, 03 Sep 2021 18:43:03 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 31
 by: Mostowski Collapse - Fri, 3 Sep 2021 18:43 UTC

Corr.:

dogecoin.avi
https://www.youtube.com/watch?v=H3oiThw2RxE

Mostowski Collapse schrieb am Freitag, 3. September 2021 um 20:24:59 UTC+2:
> Dogelog, stupid meme Prolog, total waste of time,
>
> dogecoin.avi
> https://www.youtube.com/watch?v=H3oiThw2R
>
> LoL
> Mostowski Collapse schrieb am Freitag, 3. September 2021 um 20:14:16 UTC+2:
> > You can raise an issue here when you think there
> > is something wrong with Dogelog license:
> > Issue Tracking: Dogelog Runtime
> > https://github.com/jburse/dogelog-moon/issues
> > Basically it has an elongated open source license.
> > This means it has a copyright license that makes
> > the source code available with a product, but it
> >
> > also covers usage in a lunar environment, or
> > even in the milky way. Thats why its full name is:
> >
> > Dogelog Runtime, Prolog to the Moon
> > ju...@diegidio.name schrieb am Freitag, 3. September 2021 um 18:26:43 UTC+2:
> > > On Friday, 3 September 2021 at 17:49:28 UTC+2, burs...@gmail.com wrote:
> > >
> > > > It was always open source:
> > > That's not what I was asking, open source isn't the same as open project...
> > >
> > > Julio

Re: More best kept secrets of Prolog: Pattern Matching

<sgtrb7$a4j$1@solani.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=864&group=comp.lang.prolog#864

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: janburse@fastmail.fm (Mostowski Collapse)
Newsgroups: comp.lang.prolog
Subject: Re: More best kept secrets of Prolog: Pattern Matching
Date: Fri, 3 Sep 2021 20:59:48 +0200
Message-ID: <sgtrb7$a4j$1@solani.org>
References: <sgqqbp$n1h$1@solani.org>
<01d2b75a-b769-4e5a-b6cd-d463a09751f2n@googlegroups.com>
<b83745b7-4156-4c42-a5b9-29d9a7ec4d07n@googlegroups.com>
<a0d7d89c-685d-429a-be2a-c92332bcb91fn@googlegroups.com>
<3d736c26-a38b-4d6d-9a27-12177bb242d0n@googlegroups.com>
<6cca4112-6dcf-433e-8f00-4e4920450027n@googlegroups.com>
<e885dc5a-4376-4de1-ab76-1a215d577ab2n@googlegroups.com>
<4fccfac5-d9f6-4b82-b5f7-2a6c81229c18n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 3 Sep 2021 18:59:51 -0000 (UTC)
Injection-Info: solani.org;
logging-data="10387"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:60.0)
Gecko/20100101 Firefox/60.0 SeaMonkey/2.53.9
Cancel-Lock: sha1:Ep+oH2oCJBspASClBYO9xlKMBno=
In-Reply-To: <4fccfac5-d9f6-4b82-b5f7-2a6c81229c18n@googlegroups.com>
X-User-ID: eJwFwQcBwEAIBDBLrOOLHKZ/CU2gzt7PHG443FBc8WLAmG5XhVFxeDrlJ9tSU5Z863Nz3JlxKkkWstfvB2xEFp0=
 by: Mostowski Collapse - Fri, 3 Sep 2021 18:59 UTC

BTW: Julio, if you want to implement your
own Dogelog, give it a try. You only need
this paper here (basis for Dogelog):

A portable Prolog compiler
Conference: Logic Programming Workshop - Albufeira, Portugal
William Clocksin - January 1983
https://www.researchgate.net/publication/273888197

Dogelog Runtime, Prolog to the Moon
https://qiita.com/j4n_bur53/items/17f86429745426bd14fd

And the ISO core standard. Its probably
better to start from scratch than to fork
something if you have some ideas.

Re: More best kept secrets of Prolog: Pattern Matching

<2ddcdea7-8808-419a-a20a-1864ea58e620n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=865&group=comp.lang.prolog#865

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:5c96:: with SMTP id r22mr2688668qta.267.1630747497397;
Sat, 04 Sep 2021 02:24:57 -0700 (PDT)
X-Received: by 2002:a25:644:: with SMTP id 65mr3878760ybg.300.1630747497129;
Sat, 04 Sep 2021 02:24:57 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Sat, 4 Sep 2021 02:24:56 -0700 (PDT)
In-Reply-To: <sgtrb7$a4j$1@solani.org>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sgqqbp$n1h$1@solani.org> <01d2b75a-b769-4e5a-b6cd-d463a09751f2n@googlegroups.com>
<b83745b7-4156-4c42-a5b9-29d9a7ec4d07n@googlegroups.com> <a0d7d89c-685d-429a-be2a-c92332bcb91fn@googlegroups.com>
<3d736c26-a38b-4d6d-9a27-12177bb242d0n@googlegroups.com> <6cca4112-6dcf-433e-8f00-4e4920450027n@googlegroups.com>
<e885dc5a-4376-4de1-ab76-1a215d577ab2n@googlegroups.com> <4fccfac5-d9f6-4b82-b5f7-2a6c81229c18n@googlegroups.com>
<sgtrb7$a4j$1@solani.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2ddcdea7-8808-419a-a20a-1864ea58e620n@googlegroups.com>
Subject: Re: More best kept secrets of Prolog: Pattern Matching
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Sat, 04 Sep 2021 09:24:57 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 26
 by: Mostowski Collapse - Sat, 4 Sep 2021 09:24 UTC

I still find it rewarding to work on Dogelog runtime.
Now spinning the idea of introducing occurs check
flag. Since the Albufeira instruction set has first_var/1

and var/1 instructions, we could take the route that
we followed some months ago with Jekejeke Prolog
and optimize away some occurs checks.

But we will possibly not able to realize the dynamic
freshness check as is now ultimately used in Jekejeke Prolog,
since we do not have reference counting.

Mostowski Collapse schrieb am Freitag, 3. September 2021 um 20:59:53 UTC+2:
> BTW: Julio, if you want to implement your
> own Dogelog, give it a try. You only need
> this paper here (basis for Dogelog):
>
> A portable Prolog compiler
> Conference: Logic Programming Workshop - Albufeira, Portugal
> William Clocksin - January 1983
> https://www.researchgate.net/publication/273888197
> Dogelog Runtime, Prolog to the Moon
> https://qiita.com/j4n_bur53/items/17f86429745426bd14fd
>
> And the ISO core standard. Its probably
> better to start from scratch than to fork
> something if you have some ideas.

Re: More best kept secrets of Prolog: Pattern Matching

<aca79eb7-1d07-4666-995f-1ac46ccf7c89n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=866&group=comp.lang.prolog#866

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:f81:: with SMTP id b1mr2495913qkn.275.1630747747463;
Sat, 04 Sep 2021 02:29:07 -0700 (PDT)
X-Received: by 2002:a25:22c5:: with SMTP id i188mr4341339ybi.108.1630747747238;
Sat, 04 Sep 2021 02:29:07 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Sat, 4 Sep 2021 02:29:07 -0700 (PDT)
In-Reply-To: <2ddcdea7-8808-419a-a20a-1864ea58e620n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sgqqbp$n1h$1@solani.org> <01d2b75a-b769-4e5a-b6cd-d463a09751f2n@googlegroups.com>
<b83745b7-4156-4c42-a5b9-29d9a7ec4d07n@googlegroups.com> <a0d7d89c-685d-429a-be2a-c92332bcb91fn@googlegroups.com>
<3d736c26-a38b-4d6d-9a27-12177bb242d0n@googlegroups.com> <6cca4112-6dcf-433e-8f00-4e4920450027n@googlegroups.com>
<e885dc5a-4376-4de1-ab76-1a215d577ab2n@googlegroups.com> <4fccfac5-d9f6-4b82-b5f7-2a6c81229c18n@googlegroups.com>
<sgtrb7$a4j$1@solani.org> <2ddcdea7-8808-419a-a20a-1864ea58e620n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <aca79eb7-1d07-4666-995f-1ac46ccf7c89n@googlegroups.com>
Subject: Re: More best kept secrets of Prolog: Pattern Matching
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Sat, 04 Sep 2021 09:29:07 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 42
 by: Mostowski Collapse - Sat, 4 Sep 2021 09:29 UTC

But since Dogelog runtime has change_arg/3, unlike
Jekejeke Prolog, some new hardships is on the horizon.
change_arg/3 can also create cycles not only unification.

Namely we find:

?- X = f(X).
X = f(X).

?- X = f(0), change_arg(1,X,X).
X = f(X).

The current Dogelog runtime garbage collection can
deal with the first kind of cycle. But it cannot yet deal with
the second kind of cycle.

Mostowski Collapse schrieb am Samstag, 4. September 2021 um 11:24:58 UTC+2:
> I still find it rewarding to work on Dogelog runtime.
> Now spinning the idea of introducing occurs check
> flag. Since the Albufeira instruction set has first_var/1
>
> and var/1 instructions, we could take the route that
> we followed some months ago with Jekejeke Prolog
> and optimize away some occurs checks.
>
> But we will possibly not able to realize the dynamic
> freshness check as is now ultimately used in Jekejeke Prolog,
> since we do not have reference counting.
> Mostowski Collapse schrieb am Freitag, 3. September 2021 um 20:59:53 UTC+2:
> > BTW: Julio, if you want to implement your
> > own Dogelog, give it a try. You only need
> > this paper here (basis for Dogelog):
> >
> > A portable Prolog compiler
> > Conference: Logic Programming Workshop - Albufeira, Portugal
> > William Clocksin - January 1983
> > https://www.researchgate.net/publication/273888197
> > Dogelog Runtime, Prolog to the Moon
> > https://qiita.com/j4n_bur53/items/17f86429745426bd14fd
> >
> > And the ISO core standard. Its probably
> > better to start from scratch than to fork
> > something if you have some ideas.

Re: More best kept secrets of Prolog: Pattern Matching

<f55b37b4-7311-48b8-bc77-93ce336b69f6n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=875&group=comp.lang.prolog#875

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a37:6458:: with SMTP id y85mr2344539qkb.418.1631189051318;
Thu, 09 Sep 2021 05:04:11 -0700 (PDT)
X-Received: by 2002:a05:6902:100c:: with SMTP id w12mr3282028ybt.47.1631189051163;
Thu, 09 Sep 2021 05:04:11 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Thu, 9 Sep 2021 05:04:10 -0700 (PDT)
In-Reply-To: <sgqqbp$n1h$1@solani.org>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sgqqbp$n1h$1@solani.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f55b37b4-7311-48b8-bc77-93ce336b69f6n@googlegroups.com>
Subject: Re: More best kept secrets of Prolog: Pattern Matching
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Thu, 09 Sep 2021 12:04:11 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 31
 by: Mostowski Collapse - Thu, 9 Sep 2021 12:04 UTC

There are obviously some advantage of doing Prolog parts
in Prolog itself. I am not promoting some frivolous translator
like Logtalk. But things that are used during runtime, either
for compilation or interpretation.

The advantages of doing Prolog parts in Prolog itself:

Portability: If you write in Prolog you can port to other C (or
some other host language). For example you are usually
not dependent on 32-bit versus 64-bit.
Conciseness: If you write in Prolog you can profit from a
nice rule format, it makes it usually easy to handle different
cases. (Situation has a little changed since more and more
languages provide pattern matching)
Prolog Stack: If you write in Prolog you can profit from the
Prolog stack. You don’t need to have head aches for stack
overflow in case of very large term input.

On the drawbacks one might see:

Lower Level Term Views: When you do things in Prolog you
might be deprieved from some lower functions, like
same_term/2 etc… In C (or some other host language) terms
look usually different and you have a more direct handle.
Additional Lower Level Interfaces: When you do things in
Prolog you might arrive at points where you need nevertheless
interface with some lower level data structure. This might
blow up your Prolog code a little or ask for new built-ins.
Slight Performance Penality: Even if you have a very good
Prolog system, there might be a slight performance penality
when doing things in Prolog instead of C (or some other host
language). Or you have a surprise that it is faster!

Re: More best kept secrets of Prolog: Pattern Matching

<2e902f5d-0a11-4c6f-9471-d0d6989a6ff4n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=876&group=comp.lang.prolog#876

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a37:e301:: with SMTP id y1mr2234754qki.475.1631189188138;
Thu, 09 Sep 2021 05:06:28 -0700 (PDT)
X-Received: by 2002:a25:644:: with SMTP id 65mr3282997ybg.300.1631189187974;
Thu, 09 Sep 2021 05:06:27 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Thu, 9 Sep 2021 05:06:27 -0700 (PDT)
In-Reply-To: <f55b37b4-7311-48b8-bc77-93ce336b69f6n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <sgqqbp$n1h$1@solani.org> <f55b37b4-7311-48b8-bc77-93ce336b69f6n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2e902f5d-0a11-4c6f-9471-d0d6989a6ff4n@googlegroups.com>
Subject: Re: More best kept secrets of Prolog: Pattern Matching
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Thu, 09 Sep 2021 12:06:28 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 70
 by: Mostowski Collapse - Thu, 9 Sep 2021 12:06 UTC

I am currently riding the frivolous doing it in Prolog train in
my experimental system. And had some intersting break through,
which could be also used for Dict indexing. In Dogelog runtime
I do now compute the clause index key in Prolog itself:

index_value_arg(_, A, just(F)) :- nonvar(A), !, functor(A, F, _).
index_value_arg([B = C|L], A, O) :- A == B, !, index_value_arg(L, C, O).
index_value_arg([C = B|L], A, O) :- A == B, !, index_value_arg(L, C, O).
index_value_arg([_ = _|L], A, O) :- !, index_value_arg(L, A, O).
index_value_arg(_, _, nothing).

Currently there is a limitation, the clause stores only one computed
index key value and its not just in time and its not multi-argument only
first argument. But the approach allows already eliminate this choice
point, which SWI-Prolog does more complicated:

foo(X,Y) :- Y = 1, bar = X.
foo(X,Y) :- Y = 2, baz = X.

?- foo(bar,Z).
Z = 1.

Fumbling with index_value_arg/3 could also bring indexing of
Dicts to a Prolog system. But to have just-in-time or multi-argument
indexing poses more architectual challenges. I have not yet solved in
my new experimental system. In Jekejeke Prolog they were solved
on Java level and not in Prolog.

But having a function index_value_arg/3 is the same approach
as in DDL SQL computed index:

Indexes on Computed Columns
https://docs.microsoft.com/en-us/sql/relational-databases/indexes/indexes-on-computed-columns

Mostowski Collapse schrieb am Donnerstag, 9. September 2021 um 14:04:11 UTC+2:
> There are obviously some advantage of doing Prolog parts
> in Prolog itself. I am not promoting some frivolous translator
> like Logtalk. But things that are used during runtime, either
> for compilation or interpretation.
>
> The advantages of doing Prolog parts in Prolog itself:
>
> Portability: If you write in Prolog you can port to other C (or
> some other host language). For example you are usually
> not dependent on 32-bit versus 64-bit.
> Conciseness: If you write in Prolog you can profit from a
> nice rule format, it makes it usually easy to handle different
> cases. (Situation has a little changed since more and more
> languages provide pattern matching)
> Prolog Stack: If you write in Prolog you can profit from the
> Prolog stack. You don’t need to have head aches for stack
> overflow in case of very large term input.
>
> On the drawbacks one might see:
>
> Lower Level Term Views: When you do things in Prolog you
> might be deprieved from some lower functions, like
> same_term/2 etc… In C (or some other host language) terms
> look usually different and you have a more direct handle.
> Additional Lower Level Interfaces: When you do things in
> Prolog you might arrive at points where you need nevertheless
> interface with some lower level data structure. This might
> blow up your Prolog code a little or ask for new built-ins.
> Slight Performance Penality: Even if you have a very good
> Prolog system, there might be a slight performance penality
> when doing things in Prolog instead of C (or some other host
> language). Or you have a surprise that it is faster!


devel / comp.lang.prolog / More best kept secrets of Prolog: Pattern Matching

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor