Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"Life, loathe it or ignore it, you can't like it." -- Marvin the paranoid android


devel / comp.lang.prolog / The future of Prolog dicts

SubjectAuthor
* The future of Prolog dictsMostowski Collapse
+* Re: The future of Prolog dictsMostowski Collapse
|`* Re: The future of Prolog dictsMostowski Collapse
| `* Re: The future of Prolog dictsMostowski Collapse
|  `* Re: The future of Prolog dictsMostowski Collapse
|   `* Re: The future of Prolog dictsMostowski Collapse
|    `* Re: The future of Prolog dictsMostowski Collapse
|     `* Re: The future of Prolog dictsMostowski Collapse
|      `* Re: The future of Prolog dictsMostowski Collapse
|       `* Re: The future of Prolog dictsMostowski Collapse
|        `* Re: The future of Prolog dictsMostowski Collapse
|         `* Re: The future of Prolog dictsMostowski Collapse
|          `* Re: The future of Prolog dictsMostowski Collapse
|           `* Re: The future of Prolog dictsMostowski Collapse
|            `* Re: The future of Prolog dictsMostowski Collapse
|             `- Re: The future of Prolog dictsMostowski Collapse
`* Re: The future of Prolog dictsMostowski Collapse
 `* Re: The future of Prolog dictsMostowski Collapse
  `* Re: The future of Prolog dictsMostowski Collapse
   `* Re: The future of Prolog dictsMostowski Collapse
    `- Re: The future of Prolog dictsMostowski Collapse

1
The future of Prolog dicts

<94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:7207:: with SMTP id a7mr37236466qtp.32.1629854851132;
Tue, 24 Aug 2021 18:27:31 -0700 (PDT)
X-Received: by 2002:a25:afcd:: with SMTP id d13mr52999567ybj.504.1629854850908;
Tue, 24 Aug 2021 18:27:30 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!feeder1.cambriumusenet.nl!feed.tweak.nl!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: Tue, 24 Aug 2021 18:27:30 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com>
Subject: The future of Prolog dicts
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Wed, 25 Aug 2021 01:27:31 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mostowski Collapse - Wed, 25 Aug 2021 01:27 UTC

I want to reintroduce Prolog dicts into Dogelog runtime.
But they shoud also give me module access, thus the
dot '.'/2 should replace ':'/2, and they should give me

object access, thus the dot '.'/2 should replace '::'/2
as well. Is this possible? There is now a new idea
inspired by Python and JavaScrip.

The core idea is:

When we access some dict via '.'/2, a built-in will
be executed. This built-in need not only perform an
association lookup, it can also do more.

By only modifying the behaviour of '.'/2 itself, it should
be possible to create a variety of behaviours, even
corresponding to '::'/2, i.e. single dispatch!!!

Re: The future of Prolog dicts

<1ea304a8-f51e-4882-a745-8a3a1fd3592en@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a37:624a:: with SMTP id w71mr29282140qkb.81.1629855492709;
Tue, 24 Aug 2021 18:38:12 -0700 (PDT)
X-Received: by 2002:a25:76c3:: with SMTP id r186mr34616302ybc.245.1629855492523;
Tue, 24 Aug 2021 18:38:12 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!usenet.pasdenom.info!usenet-fr.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: Tue, 24 Aug 2021 18:38:12 -0700 (PDT)
In-Reply-To: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@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: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1ea304a8-f51e-4882-a745-8a3a1fd3592en@googlegroups.com>
Subject: Re: The future of Prolog dicts
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Wed, 25 Aug 2021 01:38:12 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mostowski Collapse - Wed, 25 Aug 2021 01:38 UTC

Lets make two examples. The syntax of a method call
will be like it was for (::)/2 except that the dot '.'/2 is used.
So on the surface we will see:

Receiver.Method(Arg1,..,Argn)

This will be translated into the dict access built-in, which
for illustration purpose is simply '.'/3. And more consequently
than in the past, a call/n invokation:

'.'(Receiver, Method, Temp),
call(Temp, Arg1, .., Argn)

This is new that call/n is involved. In the past we had some
implementation (::)/2 wasnt further factored into the dictionary
getter and the meta call. We can now do the following:

1) For inheritance '.'/2 can follow some reexport chains. But
unlike our old take of modules and reexport, these chains
would now also exist for dicts.

2) For virtual methods '.'/2 can return a closure. So basically
if Method hits a virtual Function in the dictionary
it would return Function(Receiver), a compound and not

simple Function. When this return value is supplied
to the meta call, the net effect will be that Function(Receiver,
Arg1, .., Argn) is called, as desired for a virtual method.

Combining 1) and 2) means that internally '.'/3 needs either
a '.'/4 realization, that the on behalf Receiver can be passed
down in case following a reexport chain hits a virtual Function.

Or the result of '.'/3 calls another '.'''/2 which returns either
(Value,0) or (Value,1) depending on whether non-virtual or
virtual, and the wrapping is done in '.'/3.

Mostowski Collapse schrieb am Mittwoch, 25. August 2021 um 03:27:31 UTC+2:
> I want to reintroduce Prolog dicts into Dogelog runtime.
> But they shoud also give me module access, thus the
> dot '.'/2 should replace ':'/2, and they should give me
>
> object access, thus the dot '.'/2 should replace '::'/2
> as well. Is this possible? There is now a new idea
> inspired by Python and JavaScrip.
>
> The core idea is:
>
> When we access some dict via '.'/2, a built-in will
> be executed. This built-in need not only perform an
> association lookup, it can also do more.
>
> By only modifying the behaviour of '.'/2 itself, it should
> be possible to create a variety of behaviours, even
> corresponding to '::'/2, i.e. single dispatch!!!

Re: The future of Prolog dicts

<c95d7d68-b79a-4245-b70c-8a8450931f46n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:1189:: with SMTP id b9mr29922708qkk.100.1629855875290;
Tue, 24 Aug 2021 18:44:35 -0700 (PDT)
X-Received: by 2002:a25:9941:: with SMTP id n1mr15969744ybo.247.1629855875112;
Tue, 24 Aug 2021 18:44:35 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.niel.me!usenet.pasdenom.info!usenet-fr.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: Tue, 24 Aug 2021 18:44:34 -0700 (PDT)
In-Reply-To: <1ea304a8-f51e-4882-a745-8a3a1fd3592en@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: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com> <1ea304a8-f51e-4882-a745-8a3a1fd3592en@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c95d7d68-b79a-4245-b70c-8a8450931f46n@googlegroups.com>
Subject: Re: The future of Prolog dicts
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Wed, 25 Aug 2021 01:44:35 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Mostowski Collapse - Wed, 25 Aug 2021 01:44 UTC

Why do it this way, so complicated? Well we want to profit
from the split into lookup '.'/3 and simple meta call call/n. We
could then replicate for example this Python example,

when x is an object and f is a virtual function, then:

x.f()

and this here:

xf = x.f
xf()

Do the same. How is this possible? Python gives a nice explanation:

9.3.4. Method Objects
"If you still don’t understand how methods work, a look at the
implementation can perhaps clarify matters. When a non-data
attribute of an instance is referenced, the instance’s class is
searched. If the name denotes a valid class attribute that is a
function object, a method object is created by packing (pointers to)
the instance object and the function object just found together
in an abstract object: this is the method object. When the method
object is called with an argument list, a new argument list is
constructed from the instance object and the argument list,
and the function object is called with this new argument list."
https://docs.python.org/3/tutorial/classes.html

Interestingly Java and JavaScript support such method
objects. I was always marveling why the method handles have
a bind() factory method, that binding a parameter and reducing

the number of remaining parameters. But this is exactly what
a future dicts should be able to do. If they step over a virtual function,
they should bind it to the given receiver.

Mostowski Collapse schrieb am Mittwoch, 25. August 2021 um 03:38:13 UTC+2:
> Lets make two examples. The syntax of a method call
> will be like it was for (::)/2 except that the dot '.'/2 is used.
> So on the surface we will see:
>
> Receiver.Method(Arg1,..,Argn)
>
> This will be translated into the dict access built-in, which
> for illustration purpose is simply '.'/3. And more consequently
> than in the past, a call/n invokation:
>
> '.'(Receiver, Method, Temp),
> call(Temp, Arg1, .., Argn)
>
> This is new that call/n is involved. In the past we had some
> implementation (::)/2 wasnt further factored into the dictionary
> getter and the meta call. We can now do the following:
>
> 1) For inheritance '.'/2 can follow some reexport chains. But
> unlike our old take of modules and reexport, these chains
> would now also exist for dicts.
>
> 2) For virtual methods '.'/2 can return a closure. So basically
> if Method hits a virtual Function in the dictionary
> it would return Function(Receiver), a compound and not
>
> simple Function. When this return value is supplied
> to the meta call, the net effect will be that Function(Receiver,
> Arg1, .., Argn) is called, as desired for a virtual method.
>
> Combining 1) and 2) means that internally '.'/3 needs either
> a '.'/4 realization, that the on behalf Receiver can be passed
> down in case following a reexport chain hits a virtual Function.
>
> Or the result of '.'/3 calls another '.'''/2 which returns either
> (Value,0) or (Value,1) depending on whether non-virtual or
> virtual, and the wrapping is done in '.'/3.
> Mostowski Collapse schrieb am Mittwoch, 25. August 2021 um 03:27:31 UTC+2:
> > I want to reintroduce Prolog dicts into Dogelog runtime.
> > But they shoud also give me module access, thus the
> > dot '.'/2 should replace ':'/2, and they should give me
> >
> > object access, thus the dot '.'/2 should replace '::'/2
> > as well. Is this possible? There is now a new idea
> > inspired by Python and JavaScrip.
> >
> > The core idea is:
> >
> > When we access some dict via '.'/2, a built-in will
> > be executed. This built-in need not only perform an
> > association lookup, it can also do more.
> >
> > By only modifying the behaviour of '.'/2 itself, it should
> > be possible to create a variety of behaviours, even
> > corresponding to '::'/2, i.e. single dispatch!!!

Re: The future of Prolog dicts

<917e6706-b92a-4a2e-bfc8-6c4e95e3c3d1n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:724c:: with SMTP id l12mr37251263qtp.131.1629857465820;
Tue, 24 Aug 2021 19:11:05 -0700 (PDT)
X-Received: by 2002:a25:cfcc:: with SMTP id f195mr24081147ybg.341.1629857465564;
Tue, 24 Aug 2021 19:11:05 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.snarked.org!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: Tue, 24 Aug 2021 19:11:05 -0700 (PDT)
In-Reply-To: <c95d7d68-b79a-4245-b70c-8a8450931f46n@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: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com>
<1ea304a8-f51e-4882-a745-8a3a1fd3592en@googlegroups.com> <c95d7d68-b79a-4245-b70c-8a8450931f46n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <917e6706-b92a-4a2e-bfc8-6c4e95e3c3d1n@googlegroups.com>
Subject: Re: The future of Prolog dicts
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Wed, 25 Aug 2021 02:11:05 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 123
 by: Mostowski Collapse - Wed, 25 Aug 2021 02:11 UTC

Whats a little problem, predicate indicators have not only
a name, but also an arity. So what should be looked up is
a name/arity pair. Unless we start forbidding multiple

arities, or we lump sum multiple arities into one function.
We could then lookup name, and arity is checked later while
performing call/n. Some arity dispatch comes later.

Such an arity polymorphic cache is already present in
the Jekejeke Prolog atoms. Need to get my head around
how this would work out in Dogelog runtime.

Or have that these dicts are indeed keyed by predicate
indicators, so that the translation would be. We could then
pass different arities individually along inheritance chains:

'.'(Receiver, Method/n, Temp),
call(Temp, Arg1, .., Argn)

So we would have dicts with predicate indicators as
keys, this is what Prolog would demand. Or try some new
lump sum approaches, JavaScript and Python

do not demand that always the same number of arguments
is passed. Python has *args and **pairs notation to even
write routines that analyse theirs arguments in depth

beyond simple defaults. No definite idea yet.

Mostowski Collapse schrieb am Mittwoch, 25. August 2021 um 03:44:35 UTC+2:
> Why do it this way, so complicated? Well we want to profit
> from the split into lookup '.'/3 and simple meta call call/n. We
> could then replicate for example this Python example,
>
> when x is an object and f is a virtual function, then:
>
> x.f()
>
> and this here:
>
> xf = x.f
> xf()
>
> Do the same. How is this possible? Python gives a nice explanation:
>
> 9.3.4. Method Objects
> "If you still don’t understand how methods work, a look at the
> implementation can perhaps clarify matters. When a non-data
> attribute of an instance is referenced, the instance’s class is
> searched. If the name denotes a valid class attribute that is a
> function object, a method object is created by packing (pointers to)
> the instance object and the function object just found together
> in an abstract object: this is the method object. When the method
> object is called with an argument list, a new argument list is
> constructed from the instance object and the argument list,
> and the function object is called with this new argument list."
> https://docs.python.org/3/tutorial/classes.html
>
> Interestingly Java and JavaScript support such method
> objects. I was always marveling why the method handles have
> a bind() factory method, that binding a parameter and reducing
>
> the number of remaining parameters. But this is exactly what
> a future dicts should be able to do. If they step over a virtual function,
> they should bind it to the given receiver.
> Mostowski Collapse schrieb am Mittwoch, 25. August 2021 um 03:38:13 UTC+2:
> > Lets make two examples. The syntax of a method call
> > will be like it was for (::)/2 except that the dot '.'/2 is used.
> > So on the surface we will see:
> >
> > Receiver.Method(Arg1,..,Argn)
> >
> > This will be translated into the dict access built-in, which
> > for illustration purpose is simply '.'/3. And more consequently
> > than in the past, a call/n invokation:
> >
> > '.'(Receiver, Method, Temp),
> > call(Temp, Arg1, .., Argn)
> >
> > This is new that call/n is involved. In the past we had some
> > implementation (::)/2 wasnt further factored into the dictionary
> > getter and the meta call. We can now do the following:
> >
> > 1) For inheritance '.'/2 can follow some reexport chains. But
> > unlike our old take of modules and reexport, these chains
> > would now also exist for dicts.
> >
> > 2) For virtual methods '.'/2 can return a closure. So basically
> > if Method hits a virtual Function in the dictionary
> > it would return Function(Receiver), a compound and not
> >
> > simple Function. When this return value is supplied
> > to the meta call, the net effect will be that Function(Receiver,
> > Arg1, .., Argn) is called, as desired for a virtual method.
> >
> > Combining 1) and 2) means that internally '.'/3 needs either
> > a '.'/4 realization, that the on behalf Receiver can be passed
> > down in case following a reexport chain hits a virtual Function.
> >
> > Or the result of '.'/3 calls another '.'''/2 which returns either
> > (Value,0) or (Value,1) depending on whether non-virtual or
> > virtual, and the wrapping is done in '.'/3.
> > Mostowski Collapse schrieb am Mittwoch, 25. August 2021 um 03:27:31 UTC+2:
> > > I want to reintroduce Prolog dicts into Dogelog runtime.
> > > But they shoud also give me module access, thus the
> > > dot '.'/2 should replace ':'/2, and they should give me
> > >
> > > object access, thus the dot '.'/2 should replace '::'/2
> > > as well. Is this possible? There is now a new idea
> > > inspired by Python and JavaScrip.
> > >
> > > The core idea is:
> > >
> > > When we access some dict via '.'/2, a built-in will
> > > be executed. This built-in need not only perform an
> > > association lookup, it can also do more.
> > >
> > > By only modifying the behaviour of '.'/2 itself, it should
> > > be possible to create a variety of behaviours, even
> > > corresponding to '::'/2, i.e. single dispatch!!!

Re: The future of Prolog dicts

<1dabbba9-f789-415f-b502-53f3fff92745n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:622a:1452:: with SMTP id v18mr850577qtx.214.1630247731773;
Sun, 29 Aug 2021 07:35:31 -0700 (PDT)
X-Received: by 2002:a25:9241:: with SMTP id e1mr18092973ybo.38.1630247731588;
Sun, 29 Aug 2021 07:35:31 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.snarked.org!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: Sun, 29 Aug 2021 07:35:31 -0700 (PDT)
In-Reply-To: <917e6706-b92a-4a2e-bfc8-6c4e95e3c3d1n@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: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com>
<1ea304a8-f51e-4882-a745-8a3a1fd3592en@googlegroups.com> <c95d7d68-b79a-4245-b70c-8a8450931f46n@googlegroups.com>
<917e6706-b92a-4a2e-bfc8-6c4e95e3c3d1n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1dabbba9-f789-415f-b502-53f3fff92745n@googlegroups.com>
Subject: Re: The future of Prolog dicts
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Sun, 29 Aug 2021 14:35:31 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 10
 by: Mostowski Collapse - Sun, 29 Aug 2021 14:35 UTC

Interesting find, after some discussion Prolog vs LISP:

The native code for Roomba is written in a dialect of Lisp.
https://en.wikipedia.org/wiki/Roomba#Hacking_and_extending_Roomba

and the Roomba, the autonomous robotic vacuum cleaner, whose software
is written in L, a downwardly compatible subset of Common Lisp.
https://gigamonkeys.com/book/introduction-why-lisp.html

L – A Common Lisp for Embedded Systems
https://www.researchgate.net/publication/2949173

Re: The future of Prolog dicts

<ee57c8a6-b525-452e-82d9-266605d20b0cn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ae9:df07:: with SMTP id t7mr18253305qkf.95.1630248041393;
Sun, 29 Aug 2021 07:40:41 -0700 (PDT)
X-Received: by 2002:a25:af87:: with SMTP id g7mr17682995ybh.256.1630248041260;
Sun, 29 Aug 2021 07:40:41 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!usenet.pasdenom.info!usenet-fr.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: Sun, 29 Aug 2021 07:40:41 -0700 (PDT)
In-Reply-To: <1dabbba9-f789-415f-b502-53f3fff92745n@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: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com>
<1ea304a8-f51e-4882-a745-8a3a1fd3592en@googlegroups.com> <c95d7d68-b79a-4245-b70c-8a8450931f46n@googlegroups.com>
<917e6706-b92a-4a2e-bfc8-6c4e95e3c3d1n@googlegroups.com> <1dabbba9-f789-415f-b502-53f3fff92745n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ee57c8a6-b525-452e-82d9-266605d20b0cn@googlegroups.com>
Subject: Re: The future of Prolog dicts
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Sun, 29 Aug 2021 14:40:41 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Mostowski Collapse - Sun, 29 Aug 2021 14:40 UTC

L, from the 2004 paper, is somehow brother
in spirit with Dogelog runtime:
- it should produce reasonably efficient code
- compilation speed should be fast
- it should be target independent
- it should be easy to maintain

But L takes a different approach, since it has a CPU
target and not a high level language target. Nevertheless
interesting paper by Rodney A. Brooks.

LoL

Mostowski Collapse schrieb am Sonntag, 29. August 2021 um 16:35:32 UTC+2:
> Interesting find, after some discussion Prolog vs LISP:
>
> The native code for Roomba is written in a dialect of Lisp.
> https://en.wikipedia.org/wiki/Roomba#Hacking_and_extending_Roomba
>
> and the Roomba, the autonomous robotic vacuum cleaner, whose software
> is written in L, a downwardly compatible subset of Common Lisp.
> https://gigamonkeys.com/book/introduction-why-lisp.html
>
> L – A Common Lisp for Embedded Systems
> https://www.researchgate.net/publication/2949173

Re: The future of Prolog dicts

<c906b563-7ede-464b-a23a-fc5fe4d7d01bn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:622a:10c:: with SMTP id u12mr17076311qtw.303.1630248917237;
Sun, 29 Aug 2021 07:55:17 -0700 (PDT)
X-Received: by 2002:a25:cfcc:: with SMTP id f195mr17086000ybg.341.1630248917074;
Sun, 29 Aug 2021 07:55:17 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!usenet.pasdenom.info!usenet-fr.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: Sun, 29 Aug 2021 07:55:16 -0700 (PDT)
In-Reply-To: <ee57c8a6-b525-452e-82d9-266605d20b0cn@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: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com>
<1ea304a8-f51e-4882-a745-8a3a1fd3592en@googlegroups.com> <c95d7d68-b79a-4245-b70c-8a8450931f46n@googlegroups.com>
<917e6706-b92a-4a2e-bfc8-6c4e95e3c3d1n@googlegroups.com> <1dabbba9-f789-415f-b502-53f3fff92745n@googlegroups.com>
<ee57c8a6-b525-452e-82d9-266605d20b0cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c906b563-7ede-464b-a23a-fc5fe4d7d01bn@googlegroups.com>
Subject: Re: The future of Prolog dicts
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Sun, 29 Aug 2021 14:55:17 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Mostowski Collapse - Sun, 29 Aug 2021 14:55 UTC

Corr.: The paper is from 1995:

Rodney A. Brooks and Charles Rosenberg,
"L - A Common Lisp for Embedded Systems",
Lisp Users and Vendors Conference, sec. 2.4a, August 1995.

Mostowski Collapse schrieb am Sonntag, 29. August 2021 um 16:40:42 UTC+2:
> L, from the 2004 paper, is somehow brother
> in spirit with Dogelog runtime:
> - it should produce reasonably efficient code
> - compilation speed should be fast
> - it should be target independent
> - it should be easy to maintain
>
> But L takes a different approach, since it has a CPU
> target and not a high level language target. Nevertheless
> interesting paper by Rodney A. Brooks.
>
> LoL
> Mostowski Collapse schrieb am Sonntag, 29. August 2021 um 16:35:32 UTC+2:
> > Interesting find, after some discussion Prolog vs LISP:
> >
> > The native code for Roomba is written in a dialect of Lisp.
> > https://en.wikipedia.org/wiki/Roomba#Hacking_and_extending_Roomba
> >
> > and the Roomba, the autonomous robotic vacuum cleaner, whose software
> > is written in L, a downwardly compatible subset of Common Lisp.
> > https://gigamonkeys.com/book/introduction-why-lisp.html
> >
> > L – A Common Lisp for Embedded Systems
> > https://www.researchgate.net/publication/2949173

Re: The future of Prolog dicts

<0bc19977-9e41-40d9-a0bd-882951507c84n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a37:314:: with SMTP id 20mr18118995qkd.104.1630250523155;
Sun, 29 Aug 2021 08:22:03 -0700 (PDT)
X-Received: by 2002:a25:9941:: with SMTP id n1mr17676979ybo.247.1630250522871;
Sun, 29 Aug 2021 08:22:02 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.snarked.org!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: Sun, 29 Aug 2021 08:22:02 -0700 (PDT)
In-Reply-To: <c906b563-7ede-464b-a23a-fc5fe4d7d01bn@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: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com>
<1ea304a8-f51e-4882-a745-8a3a1fd3592en@googlegroups.com> <c95d7d68-b79a-4245-b70c-8a8450931f46n@googlegroups.com>
<917e6706-b92a-4a2e-bfc8-6c4e95e3c3d1n@googlegroups.com> <1dabbba9-f789-415f-b502-53f3fff92745n@googlegroups.com>
<ee57c8a6-b525-452e-82d9-266605d20b0cn@googlegroups.com> <c906b563-7ede-464b-a23a-fc5fe4d7d01bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0bc19977-9e41-40d9-a0bd-882951507c84n@googlegroups.com>
Subject: Re: The future of Prolog dicts
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Sun, 29 Aug 2021 15:22:03 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 39
 by: Mostowski Collapse - Sun, 29 Aug 2021 15:22 UTC

Ha Ha,

LISP and PROLOG having tea in the morning...
https://de.ulule.com/documentaire-alain-colmerauer/news/lisp-and-prolog-having-tea-in-the-morning-311098/

Mostowski Collapse schrieb am Sonntag, 29. August 2021 um 16:55:17 UTC+2:
> Corr.: The paper is from 1995:
>
> Rodney A. Brooks and Charles Rosenberg,
> "L - A Common Lisp for Embedded Systems",
> Lisp Users and Vendors Conference, sec. 2.4a, August 1995.
> Mostowski Collapse schrieb am Sonntag, 29. August 2021 um 16:40:42 UTC+2:
> > L, from the 2004 paper, is somehow brother
> > in spirit with Dogelog runtime:
> > - it should produce reasonably efficient code
> > - compilation speed should be fast
> > - it should be target independent
> > - it should be easy to maintain
> >
> > But L takes a different approach, since it has a CPU
> > target and not a high level language target. Nevertheless
> > interesting paper by Rodney A. Brooks.
> >
> > LoL
> > Mostowski Collapse schrieb am Sonntag, 29. August 2021 um 16:35:32 UTC+2:
> > > Interesting find, after some discussion Prolog vs LISP:
> > >
> > > The native code for Roomba is written in a dialect of Lisp.
> > > https://en.wikipedia.org/wiki/Roomba#Hacking_and_extending_Roomba
> > >
> > > and the Roomba, the autonomous robotic vacuum cleaner, whose software
> > > is written in L, a downwardly compatible subset of Common Lisp.
> > > https://gigamonkeys.com/book/introduction-why-lisp.html
> > >
> > > L – A Common Lisp for Embedded Systems
> > > https://www.researchgate.net/publication/2949173

Re: The future of Prolog dicts

<56b96927-8928-4ad1-9b9f-b4805234f83fn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a37:db02:: with SMTP id e2mr2220732qki.436.1630405346915;
Tue, 31 Aug 2021 03:22:26 -0700 (PDT)
X-Received: by 2002:a25:af87:: with SMTP id g7mr29927243ybh.256.1630405346772;
Tue, 31 Aug 2021 03:22:26 -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: Tue, 31 Aug 2021 03:22:26 -0700 (PDT)
In-Reply-To: <0bc19977-9e41-40d9-a0bd-882951507c84n@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: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com>
<1ea304a8-f51e-4882-a745-8a3a1fd3592en@googlegroups.com> <c95d7d68-b79a-4245-b70c-8a8450931f46n@googlegroups.com>
<917e6706-b92a-4a2e-bfc8-6c4e95e3c3d1n@googlegroups.com> <1dabbba9-f789-415f-b502-53f3fff92745n@googlegroups.com>
<ee57c8a6-b525-452e-82d9-266605d20b0cn@googlegroups.com> <c906b563-7ede-464b-a23a-fc5fe4d7d01bn@googlegroups.com>
<0bc19977-9e41-40d9-a0bd-882951507c84n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <56b96927-8928-4ad1-9b9f-b4805234f83fn@googlegroups.com>
Subject: Re: The future of Prolog dicts
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Tue, 31 Aug 2021 10:22:26 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Mostowski Collapse - Tue, 31 Aug 2021 10:22 UTC

Lets take a time machine, and go back to the beginnings of
Prolog. In my opinion, a must classic to read, when you want
to talk about Prolog:

Prolog - the language and its implementation compared with Lisp.
David H. D. Warren, Luis M. Pereira, Fernando Pereira:
Artificial Intelligence and Programming Languages 1977: 109-115
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.65.7097&rep=rep1&type=pdf

From its content:

We argue that pattern matching is a better method for
expressing operations on structured data than
conventional selectors and constructors - both for
the user and for the implementor.
[…]
The second factor favouring Prolog is structuresharing.
Ironically, this technique was first devised by Boyer and
Moore [1972] as a means of saving space. However it is
even more important for its contribution to Prolog’s speed.

Etc… Etc…

Re: The future of Prolog dicts

<f51b1984-a05c-4d12-a901-671f48f4e3b7n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a0c:cb8f:: with SMTP id p15mr27646037qvk.2.1630405391807; Tue, 31 Aug 2021 03:23:11 -0700 (PDT)
X-Received: by 2002:a25:e0d6:: with SMTP id x205mr29607028ybg.390.1630405391658; Tue, 31 Aug 2021 03:23:11 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!4.us.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.usenet.farm!feed.usenet.farm!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.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: Tue, 31 Aug 2021 03:23:11 -0700 (PDT)
In-Reply-To: <56b96927-8928-4ad1-9b9f-b4805234f83fn@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: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com> <1ea304a8-f51e-4882-a745-8a3a1fd3592en@googlegroups.com> <c95d7d68-b79a-4245-b70c-8a8450931f46n@googlegroups.com> <917e6706-b92a-4a2e-bfc8-6c4e95e3c3d1n@googlegroups.com> <1dabbba9-f789-415f-b502-53f3fff92745n@googlegroups.com> <ee57c8a6-b525-452e-82d9-266605d20b0cn@googlegroups.com> <c906b563-7ede-464b-a23a-fc5fe4d7d01bn@googlegroups.com> <0bc19977-9e41-40d9-a0bd-882951507c84n@googlegroups.com> <56b96927-8928-4ad1-9b9f-b4805234f83fn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f51b1984-a05c-4d12-a901-671f48f4e3b7n@googlegroups.com>
Subject: Re: The future of Prolog dicts
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Tue, 31 Aug 2021 10:23:11 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 49
 by: Mostowski Collapse - Tue, 31 Aug 2021 10:23 UTC

Pattern matching is quite important for commercial software. Its
easier to write business rules sometimes with pattern matching,
although it has a its trap doors.

Pattern matching is found in a variety of languages now:

Erlang
Haskell
JavaScript
Scala
Rust
Python
What else?

Python has it only officially with release 3.10 this year 2021.
The pattern matching found in Python is funny, since it has
a disjunction operator ‘|’. So you can say:

match x:
case [(1 | 2),(3 | 4)]:

Which doesn’t have a Prolog equivalent. So recently
I was thinking about not only introducing (=>)/2 SSU to
Prolog but also (’|’)/2 in the head. Anybody up to this challenge?

Mostowski Collapse schrieb am Dienstag, 31. August 2021 um 12:22:27 UTC+2:
> Lets take a time machine, and go back to the beginnings of
> Prolog. In my opinion, a must classic to read, when you want
> to talk about Prolog:
>
> Prolog - the language and its implementation compared with Lisp.
> David H. D. Warren, Luis M. Pereira, Fernando Pereira:
> Artificial Intelligence and Programming Languages 1977: 109-115
> http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.65.7097&rep=rep1&type=pdf
>
> From its content:
>
> We argue that pattern matching is a better method for
> expressing operations on structured data than
> conventional selectors and constructors - both for
> the user and for the implementor.
> […]
> The second factor favouring Prolog is structuresharing.
> Ironically, this technique was first devised by Boyer and
> Moore [1972] as a means of saving space. However it is
> even more important for its contribution to Prolog’s speed.
>
> Etc… Etc…

Re: The future of Prolog dicts

<7d2cd61f-45e9-4e12-b733-e8db4b8e8213n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:4659:: with SMTP id f25mr1969125qto.143.1630405494640; Tue, 31 Aug 2021 03:24:54 -0700 (PDT)
X-Received: by 2002:a25:9941:: with SMTP id n1mr29497456ybo.247.1630405494415; Tue, 31 Aug 2021 03:24:54 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder5.feed.usenet.farm!feeder1.feed.usenet.farm!feed.usenet.farm!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.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: Tue, 31 Aug 2021 03:24:54 -0700 (PDT)
In-Reply-To: <f51b1984-a05c-4d12-a901-671f48f4e3b7n@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: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com> <1ea304a8-f51e-4882-a745-8a3a1fd3592en@googlegroups.com> <c95d7d68-b79a-4245-b70c-8a8450931f46n@googlegroups.com> <917e6706-b92a-4a2e-bfc8-6c4e95e3c3d1n@googlegroups.com> <1dabbba9-f789-415f-b502-53f3fff92745n@googlegroups.com> <ee57c8a6-b525-452e-82d9-266605d20b0cn@googlegroups.com> <c906b563-7ede-464b-a23a-fc5fe4d7d01bn@googlegroups.com> <0bc19977-9e41-40d9-a0bd-882951507c84n@googlegroups.com> <56b96927-8928-4ad1-9b9f-b4805234f83fn@googlegroups.com> <f51b1984-a05c-4d12-a901-671f48f4e3b7n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7d2cd61f-45e9-4e12-b733-e8db4b8e8213n@googlegroups.com>
Subject: Re: The future of Prolog dicts
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Tue, 31 Aug 2021 10:24:54 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 76
 by: Mostowski Collapse - Tue, 31 Aug 2021 10:24 UTC

After this excursion, lets come back to Prolog dicts.
There is still quite some research going on about pattern
matching. The viewpoint of modern pattern matching is

that it should be more versatile than Prolog unification.
So some pattern compilers allow attribute matching or
sequence matching etc… Which are not part of the

Prolog language. So for example to have Datalog in the form:

?- X #> 1000, alert(stock: "Apple", price: X, day: Y)

Where X #> 1000 would be a constraint and mingled with some
some index in the dynamic database, is not part and parcel of
the Prolog language itself. If you do it like this,

no indexing will be used, using SWI-Prolog dicts:

?- alert(D), D.stock = "Apple", D.price > 1000, Y = D.day.

And you are doomed to have an O(N) algorithm, and N can be huge.
Even SQL can do better when you do:

SELECT day FROM alert
WHERE stock = "Apple" AND price > 1000

Mostowski Collapse schrieb am Dienstag, 31. August 2021 um 12:23:12 UTC+2:
> Pattern matching is quite important for commercial software. Its
> easier to write business rules sometimes with pattern matching,
> although it has a its trap doors.
>
> Pattern matching is found in a variety of languages now:
>
> Erlang
> Haskell
> JavaScript
> Scala
> Rust
> Python
> What else?
>
> Python has it only officially with release 3.10 this year 2021.
> The pattern matching found in Python is funny, since it has
> a disjunction operator ‘|’. So you can say:
>
> match x:
> case [(1 | 2),(3 | 4)]:
>
> Which doesn’t have a Prolog equivalent. So recently
> I was thinking about not only introducing (=>)/2 SSU to
> Prolog but also (’|’)/2 in the head. Anybody up to this challenge?
> Mostowski Collapse schrieb am Dienstag, 31. August 2021 um 12:22:27 UTC+2:
> > Lets take a time machine, and go back to the beginnings of
> > Prolog. In my opinion, a must classic to read, when you want
> > to talk about Prolog:
> >
> > Prolog - the language and its implementation compared with Lisp.
> > David H. D. Warren, Luis M. Pereira, Fernando Pereira:
> > Artificial Intelligence and Programming Languages 1977: 109-115
> > http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.65.7097&rep=rep1&type=pdf
> >
> > From its content:
> >
> > We argue that pattern matching is a better method for
> > expressing operations on structured data than
> > conventional selectors and constructors - both for
> > the user and for the implementor.
> > […]
> > The second factor favouring Prolog is structuresharing.
> > Ironically, this technique was first devised by Boyer and
> > Moore [1972] as a means of saving space. However it is
> > even more important for its contribution to Prolog’s speed.
> >
> > Etc… Etc…

Re: The future of Prolog dicts

<05fc9850-6341-41a7-b70a-4d03f0540052n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:66d8:: with SMTP id m24mr1985299qtp.39.1630405958587;
Tue, 31 Aug 2021 03:32:38 -0700 (PDT)
X-Received: by 2002:a05:6902:1144:: with SMTP id p4mr29362638ybu.418.1630405958451;
Tue, 31 Aug 2021 03:32:38 -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: Tue, 31 Aug 2021 03:32:38 -0700 (PDT)
In-Reply-To: <7d2cd61f-45e9-4e12-b733-e8db4b8e8213n@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: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com>
<1ea304a8-f51e-4882-a745-8a3a1fd3592en@googlegroups.com> <c95d7d68-b79a-4245-b70c-8a8450931f46n@googlegroups.com>
<917e6706-b92a-4a2e-bfc8-6c4e95e3c3d1n@googlegroups.com> <1dabbba9-f789-415f-b502-53f3fff92745n@googlegroups.com>
<ee57c8a6-b525-452e-82d9-266605d20b0cn@googlegroups.com> <c906b563-7ede-464b-a23a-fc5fe4d7d01bn@googlegroups.com>
<0bc19977-9e41-40d9-a0bd-882951507c84n@googlegroups.com> <56b96927-8928-4ad1-9b9f-b4805234f83fn@googlegroups.com>
<f51b1984-a05c-4d12-a901-671f48f4e3b7n@googlegroups.com> <7d2cd61f-45e9-4e12-b733-e8db4b8e8213n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <05fc9850-6341-41a7-b70a-4d03f0540052n@googlegroups.com>
Subject: Re: The future of Prolog dicts
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Tue, 31 Aug 2021 10:32:38 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Mostowski Collapse - Tue, 31 Aug 2021 10:32 UTC

I discovered that Python has pattern matching when I implemented
the Python version of the Dogelog runtime. Although I use it only
as a substitute for a simple switch statement, which wasn’t available

before in Python. You could model the Python match via a Prolog clause:

p([A,B]) :- (A=1;A=2), (B=3;B=4).

But the head movement that Jan W. has recently introduced in
SWI-Prolog would not work for (;)/2 in the body, so where is the
Prolog indexing for ('|')/2 patterns in the head?

Because pattern matching is useful for business rules, the
audience of Prolog is possibly not the same as for Rust. You
might have more luck addressing the same people

that are also interested in RuleML.

Re: The future of Prolog dicts

<c636dcd7-d3aa-412e-9d3c-9f65b1f038een@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a37:a603:: with SMTP id p3mr2170266qke.441.1630406007546;
Tue, 31 Aug 2021 03:33:27 -0700 (PDT)
X-Received: by 2002:a25:afcd:: with SMTP id d13mr28557854ybj.504.1630406007238;
Tue, 31 Aug 2021 03:33:27 -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: Tue, 31 Aug 2021 03:33:27 -0700 (PDT)
In-Reply-To: <05fc9850-6341-41a7-b70a-4d03f0540052n@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: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com>
<1ea304a8-f51e-4882-a745-8a3a1fd3592en@googlegroups.com> <c95d7d68-b79a-4245-b70c-8a8450931f46n@googlegroups.com>
<917e6706-b92a-4a2e-bfc8-6c4e95e3c3d1n@googlegroups.com> <1dabbba9-f789-415f-b502-53f3fff92745n@googlegroups.com>
<ee57c8a6-b525-452e-82d9-266605d20b0cn@googlegroups.com> <c906b563-7ede-464b-a23a-fc5fe4d7d01bn@googlegroups.com>
<0bc19977-9e41-40d9-a0bd-882951507c84n@googlegroups.com> <56b96927-8928-4ad1-9b9f-b4805234f83fn@googlegroups.com>
<f51b1984-a05c-4d12-a901-671f48f4e3b7n@googlegroups.com> <7d2cd61f-45e9-4e12-b733-e8db4b8e8213n@googlegroups.com>
<05fc9850-6341-41a7-b70a-4d03f0540052n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c636dcd7-d3aa-412e-9d3c-9f65b1f038een@googlegroups.com>
Subject: Re: The future of Prolog dicts
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Tue, 31 Aug 2021 10:33:27 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Mostowski Collapse - Tue, 31 Aug 2021 10:33 UTC

Python has something that could speed up pattern matching
with Dicts. Namely they call it named tuples. Python Dicts don’t
have a type tag like SWI-Prolog dicts.

On the other hand named tuples have a type tag. But named
tuples have something more. If I am not mistaking they also
allow positional access. So they are hybrid between compound

and dict, implement both protocols. And subequently could
be indexed like Prolog does index predicates. Not sure where
this all leads to. I am new to Python.

Mostowski Collapse schrieb am Dienstag, 31. August 2021 um 12:32:39 UTC+2:
> I discovered that Python has pattern matching when I implemented
> the Python version of the Dogelog runtime. Although I use it only
> as a substitute for a simple switch statement, which wasn’t available
>
> before in Python. You could model the Python match via a Prolog clause:
>
> p([A,B]) :- (A=1;A=2), (B=3;B=4).
>
> But the head movement that Jan W. has recently introduced in
> SWI-Prolog would not work for (;)/2 in the body, so where is the
> Prolog indexing for ('|')/2 patterns in the head?
>
> Because pattern matching is useful for business rules, the
> audience of Prolog is possibly not the same as for Rust. You
> might have more luck addressing the same people
>
> that are also interested in RuleML.

Re: The future of Prolog dicts

<382e6f28-26bb-462b-aee9-5b88c99bc280n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:da:: with SMTP id d26mr874218qtg.401.1630675832049;
Fri, 03 Sep 2021 06:30:32 -0700 (PDT)
X-Received: by 2002:a25:810c:: with SMTP id o12mr5299018ybk.250.1630675831874;
Fri, 03 Sep 2021 06:30: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:30:31 -0700 (PDT)
In-Reply-To: <c636dcd7-d3aa-412e-9d3c-9f65b1f038een@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: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com>
<1ea304a8-f51e-4882-a745-8a3a1fd3592en@googlegroups.com> <c95d7d68-b79a-4245-b70c-8a8450931f46n@googlegroups.com>
<917e6706-b92a-4a2e-bfc8-6c4e95e3c3d1n@googlegroups.com> <1dabbba9-f789-415f-b502-53f3fff92745n@googlegroups.com>
<ee57c8a6-b525-452e-82d9-266605d20b0cn@googlegroups.com> <c906b563-7ede-464b-a23a-fc5fe4d7d01bn@googlegroups.com>
<0bc19977-9e41-40d9-a0bd-882951507c84n@googlegroups.com> <56b96927-8928-4ad1-9b9f-b4805234f83fn@googlegroups.com>
<f51b1984-a05c-4d12-a901-671f48f4e3b7n@googlegroups.com> <7d2cd61f-45e9-4e12-b733-e8db4b8e8213n@googlegroups.com>
<05fc9850-6341-41a7-b70a-4d03f0540052n@googlegroups.com> <c636dcd7-d3aa-412e-9d3c-9f65b1f038een@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <382e6f28-26bb-462b-aee9-5b88c99bc280n@googlegroups.com>
Subject: Re: The future of Prolog dicts
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Fri, 03 Sep 2021 13:30:32 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 12
 by: Mostowski Collapse - Fri, 3 Sep 2021 13:30 UTC

The bind construct is a facinating construct. Taking a
n-ary function f and binding x1,..,xm parameters, giving
a n-m ary function g = f(x1,..,xm).

This closure construction exists also in Prolog, and is
even part of the ISO core standard. We can simply form
g = call(f,x1,..,xm), it will behave like a bound predicate,

a predicate where some arguments have already an
actual value. But the actual values x1,..,xm can also be
logical variables, so giving it a special spin in Prolog. I am

still thinking about introducing compiled lambdas in Dogelog.

Re: The future of Prolog dicts

<f5d9a9ae-aed5-44fb-94fd-5662debbfa4cn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:187:: with SMTP id x7mr1319369qtf.66.1630676418744;
Fri, 03 Sep 2021 06:40:18 -0700 (PDT)
X-Received: by 2002:a25:b941:: with SMTP id s1mr4803684ybm.304.1630676418615;
Fri, 03 Sep 2021 06:40: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 06:40:18 -0700 (PDT)
In-Reply-To: <382e6f28-26bb-462b-aee9-5b88c99bc280n@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: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com>
<1ea304a8-f51e-4882-a745-8a3a1fd3592en@googlegroups.com> <c95d7d68-b79a-4245-b70c-8a8450931f46n@googlegroups.com>
<917e6706-b92a-4a2e-bfc8-6c4e95e3c3d1n@googlegroups.com> <1dabbba9-f789-415f-b502-53f3fff92745n@googlegroups.com>
<ee57c8a6-b525-452e-82d9-266605d20b0cn@googlegroups.com> <c906b563-7ede-464b-a23a-fc5fe4d7d01bn@googlegroups.com>
<0bc19977-9e41-40d9-a0bd-882951507c84n@googlegroups.com> <56b96927-8928-4ad1-9b9f-b4805234f83fn@googlegroups.com>
<f51b1984-a05c-4d12-a901-671f48f4e3b7n@googlegroups.com> <7d2cd61f-45e9-4e12-b733-e8db4b8e8213n@googlegroups.com>
<05fc9850-6341-41a7-b70a-4d03f0540052n@googlegroups.com> <c636dcd7-d3aa-412e-9d3c-9f65b1f038een@googlegroups.com>
<382e6f28-26bb-462b-aee9-5b88c99bc280n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f5d9a9ae-aed5-44fb-94fd-5662debbfa4cn@googlegroups.com>
Subject: Re: The future of Prolog dicts
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Fri, 03 Sep 2021 13:40:18 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 41
 by: Mostowski Collapse - Fri, 3 Sep 2021 13:40 UTC

I made an intersting discovery today, concerning a new take
on lambda expression, and maybe making them automatically
compiled. So far there are various lambda libraries, they

differ in how they see variables:

- library(abstract): From Jekejeke Prolog, via (\)/2 it sees variables
in the lambda body as global by default, and you can make
variables from the lambda body local via the (^)/2.

- library(lambda): From Ulrich Neumerkel, it sees variables
in the lambda body as local by default, and you can make
variables from the lambda body global via the (+)/2.

This boils down that some variables in the body will be local
and some will be global, and some syntax will tell which is
which. Now how compile this?

From disjunction and if-then-else indexing there is a new,
which gives a reference data type:

- kb_make_defined(L, P): internal only
The built-in succeeds in P with an annonymous predicate for the clauses L.

By the nature of Prolog clauses, all variables that do not appear
in the head but appear in the body, are local. So how can we
introduce a notion of global variables?

Mostowski Collapse schrieb am Freitag, 3. September 2021 um 15:30:32 UTC+2:
> The bind construct is a facinating construct. Taking a
> n-ary function f and binding x1,..,xm parameters, giving
> a n-m ary function g = f(x1,..,xm).
>
> This closure construction exists also in Prolog, and is
> even part of the ISO core standard. We can simply form
> g = call(f,x1,..,xm), it will behave like a bound predicate,
>
> a predicate where some arguments have already an
> actual value. But the actual values x1,..,xm can also be
> logical variables, so giving it a special spin in Prolog. I am
>
> still thinking about introducing compiled lambdas in Dogelog.

Re: The future of Prolog dicts

<c04796d5-cd32-46ff-9432-f54715ee37den@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:7444:: with SMTP id h4mr3760534qtr.337.1630676941501;
Fri, 03 Sep 2021 06:49:01 -0700 (PDT)
X-Received: by 2002:a25:22c5:: with SMTP id i188mr4913211ybi.108.1630676941281;
Fri, 03 Sep 2021 06:49:01 -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:49:01 -0700 (PDT)
In-Reply-To: <f5d9a9ae-aed5-44fb-94fd-5662debbfa4cn@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: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com>
<1ea304a8-f51e-4882-a745-8a3a1fd3592en@googlegroups.com> <c95d7d68-b79a-4245-b70c-8a8450931f46n@googlegroups.com>
<917e6706-b92a-4a2e-bfc8-6c4e95e3c3d1n@googlegroups.com> <1dabbba9-f789-415f-b502-53f3fff92745n@googlegroups.com>
<ee57c8a6-b525-452e-82d9-266605d20b0cn@googlegroups.com> <c906b563-7ede-464b-a23a-fc5fe4d7d01bn@googlegroups.com>
<0bc19977-9e41-40d9-a0bd-882951507c84n@googlegroups.com> <56b96927-8928-4ad1-9b9f-b4805234f83fn@googlegroups.com>
<f51b1984-a05c-4d12-a901-671f48f4e3b7n@googlegroups.com> <7d2cd61f-45e9-4e12-b733-e8db4b8e8213n@googlegroups.com>
<05fc9850-6341-41a7-b70a-4d03f0540052n@googlegroups.com> <c636dcd7-d3aa-412e-9d3c-9f65b1f038een@googlegroups.com>
<382e6f28-26bb-462b-aee9-5b88c99bc280n@googlegroups.com> <f5d9a9ae-aed5-44fb-94fd-5662debbfa4cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c04796d5-cd32-46ff-9432-f54715ee37den@googlegroups.com>
Subject: Re: The future of Prolog dicts
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Fri, 03 Sep 2021 13:49:01 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 70
 by: Mostowski Collapse - Fri, 3 Sep 2021 13:49 UTC

The answer is very simple, through binders with call/n.
Take this example of an anonymous predicate. The
Prolog variable P is supposed to hold an opaque reference type:

P = {(X,Y) :- Y is X+Z}

The intention is that Z is added to the formal parameter X,
and the result is unified with the formal parameter Y. Unfortunatly
Z is local, but lets say we want to have Z global.

There are now two steps to do this:

- Step 1: Extends the head by the global variables.
Se we would create an anonymous predicate like this. The
Prolog variable P' is supposed hold an opaque reference type:

P' = {(Z,X,Y) :- Y is X+Z}

- Step 2: Bind the global variables:
Se we would form this closure. The Prolog variable P''
is supposed to hold the call/2 compound:

P'' = call(P', Z).

This should do the job. The expected result is now:

?- Z=2, call(P'', 1, R).
R = 3

Mostowski Collapse schrieb am Freitag, 3. September 2021 um 15:40:19 UTC+2:
> I made an intersting discovery today, concerning a new take
> on lambda expression, and maybe making them automatically
> compiled. So far there are various lambda libraries, they
>
> differ in how they see variables:
>
> - library(abstract): From Jekejeke Prolog, via (\)/2 it sees variables
> in the lambda body as global by default, and you can make
> variables from the lambda body local via the (^)/2.
>
> - library(lambda): From Ulrich Neumerkel, it sees variables
> in the lambda body as local by default, and you can make
> variables from the lambda body global via the (+)/2.
>
> This boils down that some variables in the body will be local
> and some will be global, and some syntax will tell which is
> which. Now how compile this?
>
> From disjunction and if-then-else indexing there is a new,
> which gives a reference data type:
>
> - kb_make_defined(L, P): internal only
> The built-in succeeds in P with an annonymous predicate for the clauses L.
>
> By the nature of Prolog clauses, all variables that do not appear
> in the head but appear in the body, are local. So how can we
> introduce a notion of global variables?
> Mostowski Collapse schrieb am Freitag, 3. September 2021 um 15:30:32 UTC+2:
> > The bind construct is a facinating construct. Taking a
> > n-ary function f and binding x1,..,xm parameters, giving
> > a n-m ary function g = f(x1,..,xm).
> >
> > This closure construction exists also in Prolog, and is
> > even part of the ISO core standard. We can simply form
> > g = call(f,x1,..,xm), it will behave like a bound predicate,
> >
> > a predicate where some arguments have already an
> > actual value. But the actual values x1,..,xm can also be
> > logical variables, so giving it a special spin in Prolog. I am
> >
> > still thinking about introducing compiled lambdas in Dogelog.

Re: The future of Prolog dicts

<sgtr40$a2l$1@solani.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
Path: i2pn2.org!i2pn.org!paganini.bofh.team!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: The future of Prolog dicts
Date: Fri, 3 Sep 2021 20:55:57 +0200
Message-ID: <sgtr40$a2l$1@solani.org>
References: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@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:56:00 -0000 (UTC)
Injection-Info: solani.org;
logging-data="10325"; 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
X-User-ID: eJwVwoENwCAMA7CXMmhDeg6w5v8TplnOyYd3BZORTuOMbvrVjH1DB7IXkhZCyuQokG6CJvpP1fLlrjilD0d3FNQ=
Cancel-Lock: sha1:vfUPA/OLnZLHoV781hNAEfAHMWw=
In-Reply-To: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com>
 by: Mostowski Collapse - Fri, 3 Sep 2021 18:55 UTC

Europe is a leading actor in the area of formal proofs:
about 65% of the proof systems of the world are
developed in Europe, including the two most used
proof assistants, Coq and Isabelle.
https://www.cost.eu/actions/CA20111/

LoL how did they measure 65%?

Do we always need HOL or FOL? What about these little gems:

WILL CRICHTON (2020), The Usability of Ownership, Stanford University
https://arxiv.org/pdf/2011.06171.pdf

Chalk is a library that implements the Rust
trait system, based on Prolog-ish logic rules.
https://github.com/rust-lang/chalk

Disclaimer: Have only glossed over the Rust stuff.
Dont know what logic they really use.

Mostowski Collapse schrieb:
> I want to reintroduce Prolog dicts into Dogelog runtime.
> But they shoud also give me module access, thus the
> dot '.'/2 should replace ':'/2, and they should give me
>
> object access, thus the dot '.'/2 should replace '::'/2
> as well. Is this possible? There is now a new idea
> inspired by Python and JavaScrip.
>
> The core idea is:
>
> When we access some dict via '.'/2, a built-in will
> be executed. This built-in need not only perform an
> association lookup, it can also do more.
>
> By only modifying the behaviour of '.'/2 itself, it should
> be possible to create a variety of behaviours, even
> corresponding to '::'/2, i.e. single dispatch!!!
>

Re: The future of Prolog dicts

<2df52d51-3b0c-4009-877e-93aa3deaea82n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:81c:: with SMTP id s28mr2222719qks.45.1631188501356;
Thu, 09 Sep 2021 04:55:01 -0700 (PDT)
X-Received: by 2002:a25:4ac6:: with SMTP id x189mr3316919yba.527.1631188501095;
Thu, 09 Sep 2021 04:55:01 -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 04:55:00 -0700 (PDT)
In-Reply-To: <sgtr40$a2l$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: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com> <sgtr40$a2l$1@solani.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2df52d51-3b0c-4009-877e-93aa3deaea82n@googlegroups.com>
Subject: Re: The future of Prolog dicts
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Thu, 09 Sep 2021 11:55:01 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 38
 by: Mostowski Collapse - Thu, 9 Sep 2021 11:55 UTC

Isnt this little trick known? One can make clause indexing
without head unification. For example if you want indexing
over some book id. One could do instead of this proposal:

book(book{title: "I Am Malala",
author: 'Malala Yousafzai',
publisher: 'Little, Brown & Co',
year: 2013,
isbn: 9780316322409,
edition: 1}).
Etc..

One would store:

book(9780316322409, book{title: "I Am Malala",
author: 'Malala Yousafzai',
publisher: 'Little, Brown & Co',
year: 2013,
isbn: 9780316322409,
edition: 1}).
Etc..

And then define, to avoid that retract commits too early
I use clause/3 and erase/1 combo:

assertz_book(Book) :-
assertz(book(Book.get(isbn,_), Book)).

fetch_book(Select) :-
book(Select.get(isbn,_), Book),
Select :< Book.

retract_book(Select) :-
clause(book(Select.get(isbn,_), Book), true, Ref),
Select :< Book,
erase(Ref).

I am also using the new, from a few weeks ago, get/2
on dict and the older (:<)/2.

Re: The future of Prolog dicts

<9567bab0-1f42-49d3-99f0-5607a477422an@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a37:f902:: with SMTP id l2mr2198925qkj.511.1631188545198;
Thu, 09 Sep 2021 04:55:45 -0700 (PDT)
X-Received: by 2002:a25:bb09:: with SMTP id z9mr3333476ybg.95.1631188544960;
Thu, 09 Sep 2021 04:55:44 -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 04:55:44 -0700 (PDT)
In-Reply-To: <2df52d51-3b0c-4009-877e-93aa3deaea82n@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: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com>
<sgtr40$a2l$1@solani.org> <2df52d51-3b0c-4009-877e-93aa3deaea82n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9567bab0-1f42-49d3-99f0-5607a477422an@googlegroups.com>
Subject: Re: The future of Prolog dicts
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Thu, 09 Sep 2021 11:55:45 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 61
 by: Mostowski Collapse - Thu, 9 Sep 2021 11:55 UTC

Works like a charm:

?- assertz_book(book{isbn:42, title:foo, year:1973}).

?- assertz_book(book{isbn:69, title:bar, year:1984}).

?- listing(book/2).
book(42, book{isbn:42, title:foo, year:1973}).
book(69, book{isbn:69, title:bar, year:1984}).

?- fetch_book(book{isbn:42, title:T}).
T = foo.

?- fetch_book(book{isbn:I, title:bar}).
I = 69.

?- retract_book(book{isbn:42, title:T}).
T = foo.

?- listing(book/2).
book(69, book{isbn:69, title:bar, year:1984}).

Mostowski Collapse schrieb am Donnerstag, 9. September 2021 um 13:55:02 UTC+2:
> Isnt this little trick known? One can make clause indexing
> without head unification. For example if you want indexing
> over some book id. One could do instead of this proposal:
>
> book(book{title: "I Am Malala",
> author: 'Malala Yousafzai',
> publisher: 'Little, Brown & Co',
> year: 2013,
> isbn: 9780316322409,
> edition: 1}).
> Etc..
>
> One would store:
>
> book(9780316322409, book{title: "I Am Malala",
> author: 'Malala Yousafzai',
> publisher: 'Little, Brown & Co',
> year: 2013,
> isbn: 9780316322409,
> edition: 1}).
> Etc..
>
> And then define, to avoid that retract commits too early
> I use clause/3 and erase/1 combo:
>
> assertz_book(Book) :-
> assertz(book(Book.get(isbn,_), Book)).
>
> fetch_book(Select) :-
> book(Select.get(isbn,_), Book),
> Select :< Book.
>
> retract_book(Select) :-
> clause(book(Select.get(isbn,_), Book), true, Ref),
> Select :< Book,
> erase(Ref).
>
> I am also using the new, from a few weeks ago, get/2
> on dict and the older (:<)/2.

Re: The future of Prolog dicts

<2b4f284b-bd09-45c0-b081-826646cd8f13n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:724c:: with SMTP id l12mr2382335qtp.131.1631188618224;
Thu, 09 Sep 2021 04:56:58 -0700 (PDT)
X-Received: by 2002:a25:8003:: with SMTP id m3mr3551764ybk.138.1631188618023;
Thu, 09 Sep 2021 04:56: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: Thu, 9 Sep 2021 04:56:57 -0700 (PDT)
In-Reply-To: <9567bab0-1f42-49d3-99f0-5607a477422an@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: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com>
<sgtr40$a2l$1@solani.org> <2df52d51-3b0c-4009-877e-93aa3deaea82n@googlegroups.com>
<9567bab0-1f42-49d3-99f0-5607a477422an@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2b4f284b-bd09-45c0-b081-826646cd8f13n@googlegroups.com>
Subject: Re: The future of Prolog dicts
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Thu, 09 Sep 2021 11:56:58 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 82
 by: Mostowski Collapse - Thu, 9 Sep 2021 11:56 UTC

Wouldn’t it be possible in SWI-Prolog to have this?

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

The computed column need not be stored as extending the predicate arity.

The computed column is Select.get(isbn,_), but there is also
a custom matcher involved, like (:<)/2. But the Prolog system could
have a directive:

get_isbn(Select, Isbn) :- Isbn = Select.get(isbn,_).
:- computed_index book(1, get_isbn, :<).

And then do everything under the hood, so that directly
call, assertz and retract can be used with book/1, instead
having the burden of book/2 for the end-user.

Mostowski Collapse schrieb am Donnerstag, 9. September 2021 um 13:55:45 UTC+2:
> Works like a charm:
>
> ?- assertz_book(book{isbn:42, title:foo, year:1973}).
>
> ?- assertz_book(book{isbn:69, title:bar, year:1984}).
>
> ?- listing(book/2).
> book(42, book{isbn:42, title:foo, year:1973}).
> book(69, book{isbn:69, title:bar, year:1984}).
>
> ?- fetch_book(book{isbn:42, title:T}).
> T = foo.
>
> ?- fetch_book(book{isbn:I, title:bar}).
> I = 69.
>
> ?- retract_book(book{isbn:42, title:T}).
> T = foo.
>
> ?- listing(book/2).
> book(69, book{isbn:69, title:bar, year:1984}).
> Mostowski Collapse schrieb am Donnerstag, 9. September 2021 um 13:55:02 UTC+2:
> > Isnt this little trick known? One can make clause indexing
> > without head unification. For example if you want indexing
> > over some book id. One could do instead of this proposal:
> >
> > book(book{title: "I Am Malala",
> > author: 'Malala Yousafzai',
> > publisher: 'Little, Brown & Co',
> > year: 2013,
> > isbn: 9780316322409,
> > edition: 1}).
> > Etc..
> >
> > One would store:
> >
> > book(9780316322409, book{title: "I Am Malala",
> > author: 'Malala Yousafzai',
> > publisher: 'Little, Brown & Co',
> > year: 2013,
> > isbn: 9780316322409,
> > edition: 1}).
> > Etc..
> >
> > And then define, to avoid that retract commits too early
> > I use clause/3 and erase/1 combo:
> >
> > assertz_book(Book) :-
> > assertz(book(Book.get(isbn,_), Book)).
> >
> > fetch_book(Select) :-
> > book(Select.get(isbn,_), Book),
> > Select :< Book.
> >
> > retract_book(Select) :-
> > clause(book(Select.get(isbn,_), Book), true, Ref),
> > Select :< Book,
> > erase(Ref).
> >
> > I am also using the new, from a few weeks ago, get/2
> > on dict and the older (:<)/2.

Re: The future of Prolog dicts

<82effd80-f97e-47cc-bcb7-ae98de71682bn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ad4:528c:: with SMTP id v12mr2474931qvr.44.1631188782276;
Thu, 09 Sep 2021 04:59:42 -0700 (PDT)
X-Received: by 2002:a25:d6cf:: with SMTP id n198mr3223607ybg.535.1631188782114;
Thu, 09 Sep 2021 04:59: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: Thu, 9 Sep 2021 04:59:41 -0700 (PDT)
In-Reply-To: <2b4f284b-bd09-45c0-b081-826646cd8f13n@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: <94b6ce27-6b74-4c93-9d8b-c9755e6e1d9bn@googlegroups.com>
<sgtr40$a2l$1@solani.org> <2df52d51-3b0c-4009-877e-93aa3deaea82n@googlegroups.com>
<9567bab0-1f42-49d3-99f0-5607a477422an@googlegroups.com> <2b4f284b-bd09-45c0-b081-826646cd8f13n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <82effd80-f97e-47cc-bcb7-ae98de71682bn@googlegroups.com>
Subject: Re: The future of Prolog dicts
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Thu, 09 Sep 2021 11:59:42 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 11
 by: Mostowski Collapse - Thu, 9 Sep 2021 11:59 UTC

Doing such things is usually a mental problem:

Do not under estimate expansion. DCG are also done via expansion.
Now you can ask yourself:

Is DCG expansion implemented in C (or some other host language)
for your favorite Prolog system?
Is DCG expansion implemented in Prolog
for your favorite Prolog system?

Possibly you find both approaches. You call expansion frivolous. But I
call doing Prolog parts mainly in C (or some other host language) frivolous.


devel / comp.lang.prolog / The future of Prolog dicts

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor