[m-dev.] syntax for pre and post conditions

Warwick Harvey wharvey at cs.monash.edu.au
Mon Jan 24 18:12:02 AEDT 2000


I mumbled something about

:- check zip(A,B,C) => (length(A) = length(B), length(A) = length(C)).
vs
:- check zip(A,B,C) => (length(A) = length(C), length(B) = length(C)).

The former gives a good precondition for (in, in, out) while the latter 
gives a good precondition for (out, in, in) or (in, out, in) (not that 
anyone should care about these modes for zip/3).

Thinking some more, it seems one can get the best of all worlds by rewriting 
the condition:

:- check zip(A,B,C) => (length(A) = L, length(B) = L, length(C) = L).

Maybe you can do something like this all the time?  I don't know.

Warwick

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list