🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #84

Re: Common courtesy

#84
From: Frank de Bruijn
Date: Tue, 11 Aug 1992 13:03
27 lines
1736 bytes
ken@aiai.ed.ac.uk (Ken Johnson) writes:


>#  ...a meta-interpreter could handle the symmetry, transitivity, etc.  of
>#  all relations declared as such.  One implementation technique that can
>#  be used in such a meta-interpreter is to examine the goal stack for an
>#  earlier call-frame that matches the current call frame.  This works, but
>#  it's costly......... 

>I hadn't thought of that.  It is a fascinating possibility.  Have you
>actually implemented anything this way?

>-- Ken Johnson

Indeed I did; as an experiment / toy: it works fine for relations where
the number of transitive "hops" and the number of times the predicate is
called remain small. When you go into serious AI-related search problems
(possibly exploring multiple worlds/alternatives) where the number of calls
to these relations goes beyond 100 K calls (not counting recursive subcalls)
the cost of inspecting the call stack will become prohibitive.

In general this not surprizing given that it is a solution based on a 
run-time check. In these situations a pre-compiler that introduces a new
predicate name for the symmetric / transitive relation is a good way out:
it allows clean declarative source code without a runtime price. The only
disadvantage is during debugging: predicate names not known to the programmer
may pop up.
Technical Details
Message-ID: <190@syllogi.syllogic.nl>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sun4nl!syllogi!fdb
References: <SWK.92Aug10220513@seymour.mlb.semi.harris.com> <189@syllogi.syllogic.nl> <7141@skye.ed.ac.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sun4nl!syllogi!fdb
From: fdb@syllogic.nl (Frank de Bruijn)
Newsgroups: comp.lang.prolog
Subject: Re: Common courtesy
Message-ID: <190@syllogi.syllogic.nl>
Date: 11 Aug 92 13:03:56 GMT
References: <SWK.92Aug10220513@seymour.mlb.semi.harris.com> <189@syllogi.syllogic.nl> <7141@skye.ed.ac.uk>
Organization: Syllogic B.V., Houten, the Netherlands
Lines: 28