4.2.1.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.
Option type support for Booleans
In this section: absent, deopt, occurs.
absent
predicate absent(var opt bool: x)
|
True iff x is absent |
deopt
predicate deopt(var opt bool: x)
|
Return value of x (assumes that x is not absent) |
occurs
predicate occurs(var opt bool: x)
|
True iff x is not absent |
Option type support for integers
In this section: absent, deopt, had_zero, occurs.
absent
predicate absent(var opt int: x)
|
True iff x is absent |
deopt
function var $$E: deopt(var opt $$E: x)
|
Return value of x (assumes that x is not absent) |
had_zero
test had_zero(var opt int: x)
test had_zero(opt int: x)
test had_zero(array [int] of var opt int: x)
|
True if x had zero in its original domain. Returns true if absent zero representation is disabled or if it is possible that \(\text{occurs}(x) \wedge \text{deopt}(x) = 0\) |
occurs
predicate occurs(var opt int: x)
|
True iff x is not absent |
Option type support for floats
In this section: absent, deopt, occurs.
absent
predicate absent(var opt float: x)
|
True iff x is absent |
deopt
function var float: deopt(var opt float: x)
|
Return value of x (assumes that x is not absent) |
occurs
predicate occurs(var opt float: x)
|
True iff x is not absent |
Other declarations
In this section: absent, deopt, occurs.
absent
1. test absent($T: x)
2. test absent(var $T: x)
3. test absent(set of $$T: x)
4. test absent(var set of $$T: x)
5. test absent(opt $T: x)
|
|
deopt
1. function $$T: deopt(opt $$T: x)
2. function $T: deopt(opt $T: x)
3. function array [$$U] of $$T: deopt(array [$$U] of opt $$T: x)
4. function array [$$U] of $T: deopt(array [$$U] of opt $T: x)
5. function var $T: deopt(var $T: x)
6. function $T: deopt($T: x)
7. function array [$U] of var $T: deopt(array [$U] of var $T: x)
8. function array [$$U] of var bool: deopt(array [$$U] of var opt bool: x)
9. function array [$$U] of var $$E: deopt(array [$$U] of var opt $$E: x)
10. function array [$$U] of var float: deopt(array [$$U] of var opt float: x)
|
|
occurs
1. test occurs($T: x)
2. test occurs(var $T: x)
3. test occurs(set of $$T: x)
4. test occurs(var set of $$T: x)
5. test occurs(opt $T: x)
|
|