4.2.3. Option type support¶
These functions and predicates implement the standard library for working with option types. Note that option type support is still incomplete.
4.2.3.1. Option type support for Booleans¶
Usage: not x
True iff x
is absent or false
True iff x
is absent
True iff both b0
and b1
are absent or
both are present and have the same value.
True iff b0
occurs and is equal to b1
True iff b1
occurs and is equal to b0
Search annotation for optional Boolean variables
Search annotation for optional Boolean variables
Return value of x
(assumes that x
is not absent)
Return absent if idx
is absent, otherwise return x
[ idx
]
Return absent if idx1
or idx2
is absent, otherwise return x
[ idx1
, idx2
]
Return x
[ idx
]
Return x
[ idx1
, idx2
]
Return absent if idx
is absent, otherwise return x
[ idx
]
Return absent if idx1
or idx2
is absent, otherwise return x
[ idx1
, idx2
]
True iff for at least one i
, x
[i] occurs and is true
True iff for any i
, x
[i] is absent or true
True iff x
is not absent
4.2.3.2. Option type support for integers¶
Usage: x * y
Optional multiplication. Return product of x
and y
, with absent replaced by 1.
Usage: x * y
Optional multiplication. Return product of x
and y
, with absent replaced by 1.
Usage: x + y
Optional addition. Return sum of x
and y
, with absent replaced by 0.
Usage: x + y
Optional addition. Return sum of x
and y
, with absent replaced by 0.
Usage: x - y
Optional subtraction. Return absent if x
is absent, x
if y
is absent,
difference of x
and y
if both are present.
Usage: x - y
Optional subtraction. Return absent if x
is absent, x
if y
is absent,
difference of x
and y
if both are present.
Usage: x < y
Weak comparison: true iff either x
or y
is absent, or both
occur and the value of x
is less than the value of y
.
Usage: x < y
Weak comparison: true iff either x
or y
is absent, or both
occur and the value of x
is less than the value of y
.
Usage: x <= y
Weak comparison: true iff either x
or y
is absent, or both
occur and the value of x
is less than or equal to the value of y
.
Usage: x <= y
Weak comparison: true iff either x
or y
is absent, or both
occur and the value of x
is less than or equal to the value of y
.
Usage: x > y
Weak comparison: true iff either x
or y
is absent, or both
occur and the value of x
is greater than the value of y
.
Usage: x > y
Weak comparison: true iff either x
or y
is absent, or both
occur and the value of x
is greater than the value of y
.
Usage: x >= y
Weak comparison: true iff either x
or y
is absent, or both
occur and the value of x
is greater than or equal to the value of y
.
Usage: x >= y
Weak comparison: true iff either x
or y
is absent, or both
occur and the value of x
is greater than or equal to the value of y
.
Usage: x div y
Optional division. Return absent if x
is absent, x
if y
is absent,
x
divided by y
if both are present.
Usage: x div y
Optional division. Return absent if x
is absent, x
if y
is absent,
x
divided by y
if both are present.
Usage: x mod y
Optional modulo. Return absent if x
or y
is absent,
x
modulo y
if both are present.
Usage: x mod y
Optional modulo. Return absent if x
or y
is absent,
x
modulo y
if both are present.
True iff x
is absent
Return optional 0/1 integer that is absent iff x
is absent, and 1 iff x
occurs and is true.
Return value of x
(assumes that x
is not absent)
Return absent if idx
is absent, otherwise return x
[ idx
]
Return absent if idx1
or idx2
is absent, otherwise return x
[ idx1
, idx2
]
Return x
[ idx
]
Return x
[ idx1
, idx2
]
Return absent if idx
is absent, otherwise return x
[ idx
]
Return absent if idx1
or idx2
is absent, otherwise return x
[ idx1
, idx2
]
Return optional 0/1 integer that is absent iff x
is absent, and 1 iff x
occurs and is true.
True iff both x
and y
are absent or
both are present and have the same value.
True iff only one of x
and y
is absent or
both are present and have different values.
Search annotation for optional integer variables
Search annotation for optional integer variables
Return maximum of elements in x
that are not absent, or
absent if all elements in x
are absent.
Return minimum of elements in x
that are not absent, or
absent if all elements in x
are absent.
True iff x
is not absent
Return product of non-absent elements of x
.
Return product of non-absent elements of x
.
Return sum of non-absent elements of x
.
Return sum of non-absent elements of x
.
Weak multiplication. Return product of x
and y
if both
are present, otherwise return absent.
Weak addition. Return sum of x
and y
if both
are present, otherwise return absent.
Weak subtraction. Return difference of x
and y
if both
are present, otherwise return absent.
Weak equality. True if either x
or y
are absent, or
present and equal.
4.2.3.3. Option type support for floats¶
Usage: x * y
Optional multiplication. Return product of x
and y
, with absent replaced by 1.
Usage: x * y
Optional multiplication. Return product of x
and y
, with absent replaced by 1.
Usage: x + y
Optional addition. Return sum of x
and y
, with absent replaced by 0.
Usage: x + y
Optional addition. Return sum of x
and y
, with absent replaced by 0.
Usage: x - y
Optional subtraction. Return absent if x
is absent, x
if y
is absent,
difference of x
and y
if both are present.
Usage: x - y
Optional subtraction. Return absent if x
is absent, x
if y
is absent,
difference of x
and y
if both are present.
Usage: x / y
Optional division. Return absent if x
is absent, x
if y
is absent,
x
divided by y
if both are present.
Usage: x / y
Optional division. Return absent if x
is absent, x
if y
is absent,
x
divided by y
if both are present.
Usage: x < y
Weak comparison: true iff either x
or y
is absent, or both
occur and the value of x
is less than the value of y
.
Usage: x < y
Weak comparison: true iff either x
or y
is absent, or both
occur and the value of x
is less than the value of y
.
Usage: x <= y
Weak comparison: true iff either x
or y
is absent, or both
occur and the value of x
is less than or equal to the value of y
.
Usage: x <= y
Weak comparison: true iff either x
or y
is absent, or both
occur and the value of x
is less than or equal to the value of y
.
Usage: x > y
Weak comparison: true iff either x
or y
is absent, or both
occur and the value of x
is greater than the value of y
.
Usage: x > y
Weak comparison: true iff either x
or y
is absent, or both
occur and the value of x
is greater than the value of y
.
Usage: x >= y
Weak comparison: true iff either x
or y
is absent, or both
occur and the value of x
is greater than or equal to the value of y
.
Usage: x >= y
Weak comparison: true iff either x
or y
is absent, or both
occur and the value of x
is greater than or equal to the value of y
.
True iff x
is absent
Return optional 0/1 float that is absent iff x
is absent, and 1 iff x
occurs and is true.
Return value of x
(assumes that x
is not absent)
Return absent if idx
is absent, otherwise return x
[ idx
]
Return absent if idx1
or idx2
is absent, otherwise return x
[ idx1
, idx2
]
Return x
[ idx
]
Return x
[ idx1
, idx2
]
Return absent if idx
is absent, otherwise return x
[ idx
]
Return absent if idx1
or idx2
is absent, otherwise return x
[ idx1
, idx2
]
True iff both x
and y
are absent or
both are present and have the same value.
True iff only one of x
and y
is absent or
both are present and have different values.
Search annotation for optional float variables
Search annotation for optional float variables
Return maximum of elements in x
that are not absent, or
absent if all elements in x
are absent.
Return minimum of elements in x
that are not absent, or
absent if all elements in x
are absent.
True iff x
is not absent
Return product of non-absent elements of x
.
Return product of non-absent elements of x
.
Return sum of non-absent elements of x
.
Return sum of non-absent elements of x
.
Weak multiplication. Return product of x
and y
if both
are present, otherwise return absent.
Weak addition. Return sum of x
and y
if both
are present, otherwise return absent.
Weak subtraction. Return difference of x
and y
if both
are present, otherwise return absent.
Weak equality. True if either x
or y
are absent, or
present and equal.
4.2.3.4. Other declarations¶
Test if x
is absent (always returns false)
Test if x
is absent
Return value of x
if x
is not absent. Aborts
when evaluated on absent value.
Return value x
unchanged (since x
is guaranteed
to be non-optional).
Test if x
is not absent (always returns true)
Test if x
is not absent