[mercury-users] inferred determinism

Michael Day mikeday at bigpond.net.au
Tue Feb 26 15:51:23 AEDT 2002


Hi,

The compiler infers a determinism of nondet for the predicate foo below,
unless the call to `zero' in the first clause is replaced by the literal
value 0. But it's an output argument, so why should it care? (I wasn't 
sure if this should go to mercury-bugs or mercury-features...)

Michael

:- pred foo(int, list(T)).
:- mode foo(out, in) is det.

foo(zero, []).
foo(N, [_|Xs]) :- foo(N0, Xs), N = N0+1.

:- func zero = int.

zero = 0.


--------------------------------------------------------------------------
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