[mercury-users] semidet vs unique updating

Michael Day mikeday at bigpond.net.au
Wed Oct 17 15:32:59 AEST 2001


> A better solution would be to simply return an extra boolean result
> indicating success or failure.

That is:

:- pred queue__get(queue(T), maybe(T), queue(T)).
:- mode queue__get(di, uo, uo).

Quite possible. I've only been kicking and screaming so much because it
seems that I should be able to mix unique objects with semidet code. The
declaration above is lying, or at least misleading, in that the queue
appears to be modified regardless of the outcome, and that if you called
it enough times it might return yes(T), when it never will, and making it
semidet would make that point quite clear. And would allow it to be used
in if statements, dammit.

Michael

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