top of page

Q:Is itpossible define a list variable with predefined elements,

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]];

最新記事

すべて表示
bottom of page