Article View: net.lang.prolog
Article #659Re: "assert" considered harmful? (extension tables)
From: Saumya Debray
Date: Wed, 04 Jun 1986 12:35
Date: Wed, 04 Jun 1986 12:35
30 lines
1981 bytes
1981 bytes
> When I look at the logic [of an income tax planning system], I find
> it's doing the same analysis over and over for certain legal conclusions
> that are really "facts" for other rules to deal with.
...
> Once I've determined that T1 controls T2, should I "asserta" that
> as a fact, so it no longer needs to take much time?
As Jean-Francois Lamy mentioned, "assert" is an overkill if all one
wants is the ability to remember what's already been proved. One of
the features in the Prolog system we're developing at Stony Brook is the
ability to declare that certain predicates should have "extension tables"
or "recall tables" maintained. This is basically a table where each entry
is of the form < Call, [Return_1, ..., Return_k] >. Any call to that
predicate is first looked up in the table: if a return value is already
present, the call can return immediately with the appropriate answer without
having to recompute it; otherwise, the call is made, and if/when it returns,
this <call, return> pair is entered in the table for later use. The idea
is similar to that of "memo functions" (though the implementation is
quite a bit more complex). While the implementation of the extension table
facility uses assert, this is of no concern to the programmer, who can
continue to write pure code.
--
Saumya Debray
SUNY at Stony Brook
uucp: {allegra, philabs, ogcvax} !sbcs!debray
arpa: debray%suny-sb.csnet@csnet-relay.arpa
CSNet: debray@sbcs.csnet
Technical Details
Message-ID:
<129@sbcs.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!linus!philabs!sbcs!debrayReferences:
<1229@lsuc.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!linus!philabs!sbcs!debray From: debray@sbcs.UUCP (Saumya Debray) Newsgroups: net.lang.prolog Subject: Re: "assert" considered harmful? (extension tables) Message-ID: <129@sbcs.UUCP> Date: Wed, 4-Jun-86 08:35:35 EDT Article-I.D.: sbcs.129 Posted: Wed Jun 4 08:35:35 1986 Date-Received: Fri, 6-Jun-86 05:00:12 EDT References: <1229@lsuc.UUCP> Organization: Computer Science Dept, SUNY@Stony Brook Lines: 30