[mercury-users] higher order syntax

Ralph Becket rbeck at microsoft.com
Fri Feb 11 23:24:43 AEDT 2000


> 	:- pred p(int).
> 	:- func p = pred(int).
> 
> now what does the goal p(3) mean?  Do you apply the predicate returned
> by the p/0 function to 3, or do you invoke the predicate p/1?  I guess
> this is just the usual ambiguous overloading problem and can be
> handled the same way, but somehow it seems more confusing.

Under my suggestion, p(3) is an unambiguous call to p/1, whereas (p)(3) 
means `apply(p, 3)' or `call(p, 3)' as circumstances dictate; p can be
any term that evaluates to a func or pred respectively.

So, p(X)(Y,Z) is shorthand for `apply(p(X), Y, Z)'.

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