Integers are numerals without a decimal point. The integer color set is large unless restricted by the with
clause, in which case it is small.
Declaration syntax
colset name = int [with int-exp1..int-exp2];
Order
usual ordering of integers
Optional with
clause
Restricts the integer color set to an interval determined by the two expressions in int-exp1
and int-exp2
. It must be the case that int-exp1
<=int-exp2
.
Declaration examples
colset INT = int;
colset SmallInt = int with 1..10;
An integer color set using the with
clause is used in the Simple Protocol example.
var smallInt : SmallInt;
The CPN variable smallInt
may have a range of integer values from 1 to 10. For example, 2 is a legal value, but 11 is not and 2.9 is not.
Operations
~i
: negation of the integer value ii1 + i2
: additioni1 - i2
: subtractioni1 * i2
: multiplicationi1 div i2
: division, quotienti1 mod i2
: modulus, remainderabs i
: absolute value of iInt.min(i1,i2)
: minimum of i1 and i2Int.max(i1,i2)
: maximum of i1 and i2
See also color set functions.
For additional details and functions see the INTEGER signature in the SML Basis Library Manual.
You must be logged in to post a comment.