meta_pred_list($Predicates List, $VariableList, BindingList).Predicates List: At run time, this list should be bound to either a list of predicates or a list of lists of predicates. The arguments to these predicates can either be constants or Meta-variables.
Variable List: This is
a list of Meta-variables that the user is interest in . Note that
every member of this list should also be a member of the list
of all variables occurring as arguments in the previous argument,
Predicates List.
Binding List: This regular
variable (not a Meta variable) unifies with the previous argument
after those variables are bound.
Example: Using meta_pred_list
Let us show you an instance of the meta-predicate
"meta_pred_list."
meta_pred_list( [ father(ldl_var(1), ldl_var(2)) ],
[ ldl_var(1), ldl_var(2)) ]
[ FatherName, ChildName ] )
The effect of using (or querying) the above meta
predicate is the same as making a query on a unique predicate,
say new_pred_1(FatherName, ChildName), where there is a rule of
the form:
new_pred_1(A,B) <- father(A, B).Let us now show you an example, where the "Predicates List" argument is a "list of lists of predicates":
meta_pred_list( [father(ldl_var(1), ldl_var(2))],
[mother(ldl_var(1), ldl_var(2))] ],
[ ldl_var(1), ldl_var(2) ],
[ ParentName, ChildName ] )
The meaning of the above query is the same as querying
a unique predicate, say new_pred_2(ParentName, ChildName) where
the following two rules are defined:
new_pred_2( ParentName,ChildName ) <-
father( ParentName, ChildName ).
new_pred_2( ParentName,ChildName ) <-
mother( ParentName, ChildName ).
As can be seen from above, you may pass the specifications
for any arbitrary rule inside the LDL++ meta predicate
"meta_pred_list." In the next example, we show a complete
LDL++ program demonstrating the use of the meta predicate.
The formal definitions of the various terms involved
in a Meta-Predicate are given below.
A Meta-Variable is represented as an LDL++ complex
object, ldl_var( Vname ), where Vname is the name of the Meta-Variable
represented by a constant. We denote a LDL++ Meta-Variable as
V.
A Meta-Predicate is represented as an LDL++ functor
except that it may contain LDL++ Meta-Variables, We denote a
LDL++ Meta-Predicate as P.
Given meta_pred_list( PredicateList, VariableList, BindingList ):
Carlo Zaniolo, 1997