What is the meaning of the slash after the predicate name in Prolog?

I read SO questions what does slash (/) do in prolog? and What is the meaning of the "simple / 1" predicate in Prolog (SWI-Prolog) , but these links don't seem to help me.

I was going though some beginner tutorials on Prolog. Phrases like Solve/4 or Go/1 confused me. What does this trait and number mean?

+7
source share
3 answers

This is the number of arguments that the function expects in its signature. Be careful with infix operators that can take multiple arguments, even if they are called by placing them between the arguments. That is, you can think of something like a regular add, + , like a binary operator. So, A+B really matches +(A,B) , which means that you define + with +/2 .

+13
source

I quote from page 8 "Prolog: standard: reference manual" (2 ^ entry when I googled "prolog predicate indicator").

Predicate indicator ... This is the main term for the Name / Arity form.

The built-in ISO / 3 functor accesses this data.

 ?- functor(append(a,b,c),Name,Arity). Name = append, Arity = 3. 
+2
source

As EMS and Chac explained, this number indicates the number of arguments. The reason you find this number in the documentation is because predicates with the same name and different degrees (number of arguments) are different predicates.

So the predicate:

 my_predicate/3 

is another predicate:

 my_predicate/4 

and a number is included to give a clear indication of which one they are talking about.

+2
source

All Articles