I am writing a Prolog program, and I am trying to incorporate modules into the program design to encapsulate complexity reduce redundant functionality.
One feature I am having difficulty with is the use of metapredicates. I would like to define a metapredicate in one module and then import it into a different module; this introduces complications. Fortunately, the meta_predicate
directive helps resolve module prefixes, but I am having trouble understanding the arguments as described here: https://www.swi-prolog.org/pldoc/man?section=metapred
Specifically, I am having trouble with the numeric arguments. As per the documentation:
The argument is a term that is used to reference a predicate with N more arguments than the given argument term. For example: call(0) or maplist(1, +).
I understand that an argument denoted by the numeric value will be a term that is used to reference a predicate. What I do not understand is how the referenced predicate could have more arguments than the argument term. Can someone offer a more in-depth explanation of when the numeric argument is appropriate, or an example of when it would be appropriate to use it?