[net.lang.prolog] Bagof

SHardy@SRI-KL@sri-unix.UUCP (10/17/83)

How does one decide what Bagof or Assert/Retract should do?

Recently, I read of a new implementation of Prolog.  It had an
exciting new lazy evaluation mode.  It could outperform DEC-10
Prolog.  What is more, it had access to all sorts of good things
like screen editors and windows.

Unfortunately, its definition of Bagof was ``wrong'', that is
didn't agree with the definition of Bagof on the DEC-20.

Actually, this doesn't bother me since I think DEC-20 Prolog
has it wrong.  As Richard says, it depends on what one thinks
should happen to calls like:

        ?- bagof(X, likes(X, Y), LIKERS).

Should LIKERS be the bag of all Xs that like anything or should
it be the bag of all Xs that like the same thing with failure
generating a new set?

The interpretation I prefer is the first; it should be the set
of all Xs who like anything.

I understand how others may disagree with my preference.  I don't
understand how one could think one interpretation ``objectively''
right and the other wrong.

There is just a little Edinburgh imperialism underlying Richard's
messages !

-- Steve,
   Teknowledge


PS: it is a mistake to have Assert/Retract modify the behaviour
    of currently active procedure calls.  That's why the Newpay
    example is so hard in DEC-10 Prolog.  The solution is to
    change DEC-10 Prolog.