[mercury-users] ho_map typeclass question

Fergus Henderson fjh at cs.mu.OZ.AU
Tue May 8 13:20:13 AEST 2001


On 07-May-2001, Terrence Brannon <princepawn at earthlink.net> wrote:
> === question:
> Given this snippet:
> 
> :- pred blah(int::in, int::out) is det.
> 
> blah(X, X+1).
> 
> why is X+1 a legal thing to send to an out parm?

That's just an ordinary function call to the function '+'
in the usual "func '+'(in, in) = out" mode.

> Does this result in a decrement of X or what?

No.  Perhaps you meant a slightly different example:

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

	blah(X+1, X).

That example will compute the output value for the second argument
of blah/1 by subtracting one from the value of the first argument.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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