Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does +,+ mode in Prolog mean?

So am being told a specific predicate has to work in +,+ mode. What does that mean in Prolog?

like image 670
chutsu Avatar asked Nov 27 '11 02:11

chutsu


1 Answers

When one wants to give information on a predicate in prolog, those conventions are often used :

arity : predicate/3 means predicate takes 3 arguments.

parameters : predicate(+Element, +List, -Result) means that Element and List should not be free variables and that Result should be a free variable for the predicate to work properly. ? is used when it can be both, @ is mentionned on the above answer but is not really used as much (at least in swi-pl doc) and means that the input will not be bound during the call.

so telling that somepredicate works in +, + mode is a shortcut for telling that :

% somepredicate/2 : somepredicate(+Input1, +Input2)
like image 158
m09 Avatar answered Sep 29 '22 20:09

m09