[mercury-users] Modes in "int" module.

Bartlomiej Szymczak rhywek at gmail.com
Tue Jul 10 05:34:33 AEST 2007


Hello.

I don't understand one thing in the "int" library module:

     :- pred int.max(int::in, int::in, int::out) is det.

     :- func int + int = int.
     :- mode in  + in  = uo  is det.

Both operations (max and +) have the same type from mathematical point
of view - they take two numbers and deterministically produce another
number.

What I don't understand is why + produces result in mode uo. Shouldn't
it produce result in mode out, like max does?

Additionally I don't like that there are only functions to do some
things. It would be really nice for me if predicate versions were
provided.

One more problem is that in the documentation the modes for int.plus
function are not shown:
:- func int.plus(int, int) = int.

I assume they are the same as for +, but I would prefer to be sure.

Best regards,
-- 
Bartlomiej Antoni Szymczak

Gmail: rhywek at gmail.com
Work mail: bas at imm.dtu.dk
Student mail: s041702 at student.dtu.dk
DTU office: 321/129
DTU tel.: +4545253892
Mobile: +4520789323
--------------------------------------------------------------------------
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