[mercury-users] Again: cc_ problem - what is Context requiring all solutions...

Ondrej Bojar oboj7042 at ss1000.ms.mff.cuni.cz
Fri Sep 7 00:23:13 AEST 2001


On Wed, 5 Sep 2001, Simon Taylor wrote:
> :- pred cc_tagmap(int::in, attrpath::out) is semidet.
>
> cc_tagmap(Ind, Result) :-
> 	Result = promise_only_solution(
> 		(pred(Path::out) is cc_nondet :-
> 			tagmap(Path, _Value, Ind, _Char)
> 		)).

This is what I needed! Thanks!

I didn't know, how to use the promise_only_solution, because I didn't
realize one can use lambda expressions to put input variables into:

:- func promise_only_solution(pred(T)) = T.
:- mode promise_only_solution(pred(out) is cc_multi) = out is det.
:- mode promise_only_solution(pred(out) is cc_nondet) = out is semidet.

...and there is no example in Mercury documentation for this.

Thanks again.

P.S.: Mercury docs should also warn louder about the difference between
"pred<space>(" and "pred(", as the error messages you get when using the
former are not too explanatory... :-)

Andrew.

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


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