[mercury-users] Testing with dependent lists?

doug.auclair at logicaltypes.com doug.auclair at logicaltypes.com
Mon Feb 12 11:57:04 AEDT 2007


Dear Ralph, you wrote:

>> for_each_switch([_|_], _, _, [], _) -->
>> 	{ error("Answers depend on switches") }.
>> for_each_switch([_|_], _, _, _, []) -->
>> 	{ error("Expectations depend on switches") }.
>These two clauses are not mutually exclusive, which is your problem.

Ah, yes, my mistake (thinking in Prolog, again). This means then, that I 
would need to add two MORE "redundant" clauses? Or, of course, 
replace the lot with a '->' switch on conditional (in body) unification, 
which is what I ended up doing (but hating the process).

So, is there a way in Mercury to declare to the compiler the inst of
one object based on the inst of another in a clause head?  My reading 
of the refman doesn't seem to indicate that functional dependences 
address this. Am I wrong?  If so, how do I construct such a dependency; 
if not, what is another way to go about this? ... or, can functional 
dependencies be extended to include inst relationships?  (Does instance 
relationships give a near enough equivalent to this issue to solve the 
problem?)

Sincerely,
Doug Auclair

--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list