I am teaching myself Prolog and have been given a handful of examples.
One of which uses the dynamic/1 built-in directive:
:- dynamic(items/1).
I get the idea of dynamic. That one can modify predicates via the assert, and retract predicates.
However, the program also uses the following in places:
:- dynamic(location/2).
What is the difference between the two /1 and /2, is their also a /3 .... /n?
In Prolog, predicates are identified by their name (or functor) and their number of arguments (or arity). Thus,
items/1denotes a predicate with functoritemsand arity1whilelocation/2denotes a predicate with functorlocationand arity2. Two predicates with the same functor but different arities are different predicates.