You have an example of how to use the index with a function in the following manual (Page 8)
Look at the declared Chopsticks function:
val n = 5;
colset PH = index ph with 1..n;
colset CS = index cs with 1..n;
var p: PH;
fun Chopsticks(ph(i)) =
1`cs(i) ++ 1`cs(if i=n then 1 else i+1);
When you declare an index, you declare an id such as ph or cs. You can pass an index by its integer value using the id followed by its number, like cs(1).
So, if you want to iterate, you can use the integer value assigned to its id.
You have an example of how to use the index with a function in the following manual (Page 8)
Look at the declared
Chopsticks
function:When you declare an index, you declare an
id
such asph
orcs
. You can pass an index by its integer value using theid
followed by its number, likecs(1)
.So, if you want to iterate, you can use the integer value assigned to its id.