Q:Is itpossible define a list variable with predefined elements,
- MSI株式会社
- 2021年4月13日
- 読了時間: 1分
Is itpossible define a list variable with predefined elements, where the onlyvariable is their order?
Example:
x <- list(5);
contains(x, 0);
contains(x, 1);
not contains(x, 2);
not contains(x, 3);
contains(x, 4);
A:You can do this by constraining the above expressions. However, I wouldsuggest doing otherwise. I would use a list of domain 3 and use a map asfollows.
myMap[0] <- 0;
myMap[1] <- 1;
myMap[2] <- 4;
x <- list(3);
elementAtFirstPosition <- myMap[x[0]];
Comments