Next: Term Expressions, Previous: Indexicals, Up: Defining Primitive Constraints [Contents][Index]

A range expression has one of the following forms, where `Ri` denote
range expressions, `Ti` denote integer valued *term
expressions*, `S(Ti)` denotes the integer value of `Ti` in
`S`, `X` denotes a variable, `I` denotes an integer, and
`S` denotes the current store.

`dom(`

`X`)evaluates to

`D(X,S)``{`

`T1,…,Tn`}evaluates to {

`S(T1),…,S(Tn)`}. Any`Ti`containing a variable that is not “quantified” by`unionof/3`

will cause the indexical to suspend until this variable has been assigned.`T1`..`T2`evaluates to the interval between

`S(T1)`and`S(T2)`.`R1`/\`R2`evaluates to the intersection of

`S(R1)`and`S(R2)``R1`\/`R2`evaluates to the union of

`S(R1)`and`S(R2)``\`

`R2`evaluates to the complement of

`S(R2)``R1`+`R2``R1`+`T2`evaluates to

`S(R2)`or`S(T2)`added pointwise to`S(R1)``-`

`R2`evaluates to

`S(R2)`negated pointwise`R1`-`R2``R1`-`T2``T1`-`R2`evaluates to

`S(R2)`or`S(T2)`subtracted pointwise from`S(R1)`or`S(T1)``R1`mod`R2``R1`mod`T2`evaluates to the pointwise floored modulo of

`S(R1)`and`S(R2)`or`S(T2)``R1`rem`R2``R1`rem`T2`evaluates to the pointwise truncated remainder of

`S(R1)`and`S(R2)`or`S(T2)``R1`?`R2`evaluates to

`S(R2)`if`S(R1)`is a non-empty set; otherwise, evaluates to the empty set. This expression is commonly used in the context`(`

, which evaluates to`R1`? (inf..sup) \/`R3`)`S(R3)`if`S(R1)`is an empty set; otherwise, evaluates to`inf..sup`

. As an optimization,`R3`is not evaluated while the value of`R1`is a non-empty set.`unionof(`

`X`,`R1`,`R2`)evaluates to the union of

`S(E1),…,S(EN)`, where each`EI`has been formed by substituting`K`for`X`in`R2`, where`K`is the`I`:th element of`S(R1)`. See N Queens for an example of usage.**Please note**: if`S(R1)`is infinite, then the evaluation of the indexical will be abandoned, and the indexical will simply suspend.`switch(`

`T`,`MapList`)evaluates to

`S(E)`if`S(T1)`equals`K`and`MapList`contains a pair

. Otherwise, evaluates to the empty set. If`K`-`E``T`contains a variable that is not “quantified” by`unionof/3`

, then the indexical will suspend until this variable has been assigned.

Send feedback on this subject.