SHardy@SRI-KL@sri-unix.UUCP (10/11/83)
A recent message on the use of Assert seemed to imply that it, and Retract, shouldn;t be used because neither is well implemented on the DEC-10 and both are, in fact, quite hard to implement. In general, I think it a bad idea to object to using a feature of a langauge because it is often badly impelemented. If carried to an extreme, this view becomes silly. I once saw an article ``refuting'' the claim that Prolog was inefficient by saying that the claimant had not programmed ``idiomatically'' (I.e. had used Assert) and so, presumably, deserved all he got. Although Assert is ``not very logical'', it can be extremely useful. Without Assert one could not implement SetOf. Without SetOf all kinds of things (such as making use of a closed world assumption) are hard. Crucially, Prolog now has several classes of user. Some are concerned with its purity and logical roots; others are concerned with getting fast performance out of Prolog on Von Neumann machines; others are concerned with using Prolog to solve some problem. Why should the last group be bothered by the concerns of the first two? -- Steve Hardy, Teknowledge
SHardy%SRI-KL@sri-unix.UUCP (11/01/83)
A recent message suggested that users wanting to use ASSERT and
RETRACT (to model, say, a network) should not use the built in
definitions but instead re-implement those operations using, the
message said, a tree like term to represent a personal database,
I.e.:
tree(PROPOSITION, LEFTSUBTREE, RIGHTSUBTREE).
This tree would be passed as an explicit extra argument to all
predicates. This approach, it was suggested, is both cleaner and
more efficient than using ASSERT.
I have a comment and a question. The comment is that programs
are no cleaner for being written by users than by system programmers.
A program written using terms as a personal database will be just as
hard to analyse automatically (say) as a program using ASSERT and
RETRACT. The reason for this is that the TREE term has as its
intended interpretation a collection of propositions, unlike most
terms whose interpretation is some object in the real world.
Propositions, such as HUMAN(STEVE, TREE), start having bizarre
interpretations too. Mixing terms and meta-terms in the same
program always leads to confusion irrespective of who does it,
user or system.
The question is addressed mainly to Prolog implementors. Does
anyone know of a Prolog implementation that, like Genesereth's
MRS, uses different representations for stored propositions
depending on the use those propositions get ? For example, the
following code:
setq(L, R) :- retract(eval(L, R)), assert(eval(L, R)).
provides something close to assignment. A smart Prolog system
could recognize the code and store EVAL as a collection of
ordinary Von Neumann variables.
-- Steve Hardy,
Teknowledge