[mercury-users] tabling

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed Nov 29 13:46:10 AEDT 2000


On 28-Nov-2000, Dominique de Waleffe <ddw at miscrit.be> wrote:
> Is it not possible to have the tabling code do simple pointer comparisons in
> some cases?
> In the case at hand, the map() argument is something computed at the time
> the service starts and remains constant throughout the run (we are talking
> about weeks...).

Hash consing is one way in which the map could be tabled with a pointer
comparison.

However, it seems that there is a simpler solution for your particular problem.
The requirement that tabling places on the comparison function it uses is
"if the function says that the value in the call and the value in the table
are equal, then they are really equal". It does *not* require "if that the
value in the call and the value in the table are equal, then the comparison
function says they are equal". In other words, a safe approximation is
acceptable. Pointer equality is such an approximation.

We could add an optional argument to the pragma memo declaration to tell the
compiler that a given set of arguments should be tabled by address, not by
value. This would solve your efficiency problem; although it may not be
quite as fast as the solution Tyson proposed, it would be cleaner.

Any proposals for the syntax?

Zoltan.
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list