[mercury-users] functions returning in values?

Terrence Brannon princepawn at earthlink.net
Tue May 8 12:37:02 AEST 2001


The standard mode for a func argument is in and the return value if
mode out. For example:

A = f(X).

for 

:- func f(int) = int.
:- mode f(in)  = out.

However, I was meandering through the Mercury source files and
somewhere came across something like this:

:- func g(int) = int.
:- mode g(out) = in.

In other words, it takes and _out_ mode variable as its argument and
_returns_ and in mode value... If you could help me out, I would like
to know how one might call such a function and I am a bit confused as
to when such a mode setup would be advantageous. 

Thanks.



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