I've read the SO questions what does slash(/) do in prolog? and What is the meaning of predicate “simple/1” 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 that slash and number mean?
It is the number of arguments that the function expects in its signature. Be careful of infix operators, which can accept multiple arguments even if the way they are called is by placing them in between the arguments. That is, you can think of something like ordinary addition, +
, as a binary operator. So A+B
is really the same as +(A,B)
, which means you would define +
with +/2
.