Next: Matrix Predicates
Up: Grace Utility Predicates
Previous: Grace Utility Predicates
All of these predicates are quite frequently needed when constraints
over variables from a list are created or imposed.
Note that list elements are numbered from 1.
- list(+Size, +Domain, -List)
-
List is a list with Size domain variables
whose domain is Domain.
Size is a positive integer or an integer expression.
Domain may have any form accepted by ::/2
.
In addition, if Domain is random(Min, Max),
the variables will be random integers from this range.
This latter form is useful for generating random data.
- list_elem(+Pos, +List, -Element)
-
Returns the Pos-th element of the list List.
- list_range(+From, +To, +List, -SubList)
-
Returns the specified range of a list, starting from the From-th
element and ending with the To-th element.
- list_rem(+Pos, +List, -SubList)
-
Returns the remainder of the list List starting
from its Pos-th element.
If Pos is 1, the whole list is returned.
- list_sum(+List, -Sum)
-
Sum is a structure that expresses the symbolic sum
of the list elements,
e1 + e2 + e3 + ...
- list_product(+List1, +List2, -Product)
-
Product is the symbolic scalar product of the two lists,
i.e. a structure
k1*l1 + k2*l2 + k3*l3 + ...
- boolean_list_elem(+Pos, +List)
-
Instantiate the Pos-th list element to 1 and all other
elements to 0.
- int_list(+From, +To, +Step, -List)
-
Generate a list of integers, starting with From
and ending with To, the distance between list elements
is Step.
- delete_var(+Var, +List, -Rest)
-
Remove the variable Var from the list List
and return the remaining list Rest.
It fails if the variable does not occur in the list.
Next: Matrix Predicates
Up: Grace Utility Predicates
Previous: Grace Utility Predicates
Micha Meier
Tue Jul 2 10:07:34 MET DST 1996