Reputation: 31
I am a beginner in the Prolog language and I am in a situation where dynamic/1 is being used. In my code there is a line, for example that goes like this:
:- dynamic actual_position/1, at/2, holding/1, talked/1, examined/1.
I want to understand why actual_position has a /1 as compared to at which has a /2.
Thank you!
Upvotes: 3
Views: 303
Reputation: 477200
The number after the slash (/
) is the arity of the predicate: it is the number of parameters it takes. So member/2
means a member
predicate or functor with two parameters.
The arity is important since, just like in Java for example, one can overload predicate names: one can define multiple predicates with the same name but a different arity. For example append/2
[swi-doc] concatenates a list of lists to a single list, whereas append/3
[swi-doc] appends two lists together in a single list.
Upvotes: 3