Discussions related to Visual Prolog
mdosnov2016
VIP Member
Posts: 73
Joined: 19 Nov 2016 7:58

how can I declare and have my goal to be a (non-)determ instead of procedure

Unread post by mdosnov2016 »

Because I have a lot of trouble with some nondeterministic calls from inside my project's goal,
how can I declare and have my goal to be a (non-)determ instead of a procedure, as it is declared
now (and I don't know where it is declared as such)?

If I don't have procedure type on my goal the VP8 compiler gives me a related error:
e504 The expression has type '() nondeterm', which is incompatible with the type '() procedure' main.pro

and with the goal being:

Code: Select all

goal     console::runUtf8(main::testtop).
PrologUser
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Re: how can I declare and have my goal to be a (non-)determ instead of procedure

Unread post by Thomas Linder Puls »

You cannot. The goal must be a procedure. The typical goal in a console program contains a call to console::runUtf8 (as in your code). And predicate you provide as argument in that call must also be a procedure.

So in your code main::testtop must be a procedure.

This is very natural, because the goal is what the program run and a program does not "fail" or return many times.

I suggest you read and follow the tutorials and write "small" code until you are comfortable with things like procedure, determ, nondeterm, backtracking, fail, succeed, cut, ...
Regards Thomas Linder Puls
PDC
Post Reply