In the beginning of a Prolog program I see:
:-dynamic(path/1).
It seems to be a clause that doesn't have a head. What does it mean?
When Prolog interpreter sees :-
in front of a clause when loading the program, the clause gets executed right away, rather than becoming part of the program "database". The most common use of the :-
is defining the starting predicate of your program at the end of your program file, so that loading the file with your program causes it to run.
Specifically, dynamic/1
informs the interpreter that the definition of the specified predicate may change at runtime. This is something the interpeter needs to know before reading the rest of your program, so that it could make special arrangements for uses of the path/1
predicate.