[mercury-users] cc_multi question

Peter Ross peter.ross at miscrit.be
Sat Nov 30 10:44:34 AEDT 2002


Hi,

Below is some code abstracted from the RTTI stuff that I am doing.
(q = deconstruct) and (p = limited_deconstruct).  It was originally coded
all coded up in C, so no Mercury compiler to make happy.  However with the
mercury implementation I get the following error.  Can anyone help me on
what the correct solution is?

The only thing I can think of is to use promise_only_solution, but that just
doesn't feel right to me.


% main.m:018: Error: call to predicate `main:q/2' with determinism `cc_multi'
% main.m:018:   occurs in a context which requires all solutions.
% For more information, try recompiling with `-E'.
:- module main.

:- interface.

:- type t
	--->	f(int)
	;	g(int).

:- pred p(int::in, int::out) is cc_nondet.

:- implementation.

:- import_module int.

p(A, B) :-
	q(f(A), B),
	B < 5.

:- pred q(t::in, int::out) is cc_multi.

q(f(A), A).
q(f(A), A+1).
q(g(B), B).
--------------------------------------------------------------------------
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