Previous Page | Next Page

The CLP Procedure

FOREACH Statement

FOREACH (array, type, <offset>) ;

where array must be defined using an ARRAY statement, type is a keyword that determines the type of the constraint, and offset is an integer. The default value is 0.

The FOREACH statement iteratively applies a constraint over an array of variables. The type of the constraint is determined by type. The optional offset parameter is an integer and is interpreted in the context of the constraint type.

Currently, the only valid type keyword is DIFF.

The FOREACH statement corresponding to the DIFF keyword iteratively applies the following constraint to each pair of variables in the array:


For example, the constraint that all ’s are pairwise distinct for an array is expressed as

   foreach (A, diff, -1);

Note: This procedure is experimental.

Previous Page | Next Page | Top of Page