[mercury-users] IO in nondet or semidet functions
Aditya Raj PATHANIA
adityarp at students.cs.mu.OZ.AU
Mon Oct 13 10:27:13 AEST 2003
hi,
presently i'm writing an fd solver in mercury. the problem i'm facing is
that i need to generate multiple solutions, using labeling. since labeling
is almost always a nondet function (i guess), i'm unable to do IO using
mercury's io__write and io__print, since mercury does not backtrack over
IO.
my labeling procedure is simply this...
:- pred labeling(list(int)).
:- mode labeling(in) is nondet.
labeling(Thelist) :-
(
Thelist = [],
solver_print_all_variables, % this is a C procedure which
i want to replace with io__print or io__write
all_solns % this just makes the clause fail or succeed
depending on whether i want to generate multiple soltuions
;
Thelist = [V|Vs],
solver_min_domain(V,Min),
solver_max_domain(V,Max),
(if Min = Max then
labeling(Vs)
else
label(V,Min,Vs)
)
).
could someone please suggest a solution or some other technique for this.
thanks.
aditya
--------------------------------------------------------------------------
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