[mercury-users] How do you call a semidet constant function?

Ian MacLarty maclarty at cs.mu.OZ.AU
Fri Mar 10 06:08:48 AEDT 2006


On Fri, Mar 10, 2006 at 03:44:16AM +1100, Mark Brown wrote:
> Hi Ian,
> 
> On 10-Mar-2006, Ian MacLarty <maclarty at cs.mu.OZ.AU> wrote:
> > Hello,
> > 
> > I'm trying to implement a function like the following:
> > 
> > :- func default_value(((func) = T)::in((func) = out is semidet), T::in)
> > 	= (T::out) is det.
> > 
> > default_value(F, X) =
> >         ( if F = Y then
> >                 Y
> >         else
> >                 X
> >         ).
> > 
> > How do I convince the compiler to unify Y with the result of F and not
> > the function F?
> 
> Use apply(F).

Thanks.

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