[mercury-users] Re: Fergus' hack

Peter Schachte pets at students.cs.mu.oz.au
Mon Oct 13 12:08:26 AEST 1997


On Thu, 9 Oct 1997, Fergus Henderson wrote:
> Bart Demoen <bmd at cs.kuleuven.ac.be> writes:
> >Fergus wrote:
> >> [Bart wrote:]
> >> > But adding the extra forward/backward argument to p
> >> > gives the impression that the same relation exists between X and Y in
> >> > both modes,
> >> 
> >> Huh?  Why do you think that?
> >
> >I apologize for making the same mistake over and over again - blame it
> >on my age and perception of programming; Fergus is perfectly right,
> >the meaning of a logic program does not depend on the actual names of
> >the constants and I should never, never, never again find any
> >intuitive meaning in the name of the constants.
> ...
> >p106
> >
> >p107 p108
> 
> I take it then that you are objecting to the particular names
> that I used in my example, rather than to the technique itself? ;-)
> Certainly it is possible to use more informative names, such as say
> parse/pretty_print rather than just forward/backward.

I think it would be better to make the argument reflect the logic, rather
than the mode, of the distinction.  Perhaps a boolean argument indicating
whether extra whitespace is allowed or not?

In this case, the extra argument specifies which of two (or more) 
relationships hold between X and Y.  While this might be a bit more clumsy
than just having two different predicates, it may save considerable code
duplication (and numerous maintenance problems).


-Peter Schachte      URL:  http://www.cs.mu.oz.au/~pets/
pets at cs.mu.OZ.AU     PGP:  finger pets at 128.250.37.150 for key
    Do insects spend hours demammaling their programs?




More information about the users mailing list