next up previous index
Next: Arrays and Global Variables Up: Arithmetic Previous: The Multi-Directional Predicates plus/3   Index


Arithmetic and Coroutining

The behaviour of the arithmetic predicates is slightly different when the system operates in coroutining mode. This applies to all the predicates that evaluate their arguments (ie. is/2 and the arithmetic comparisons) as well as to plus/3, times/3 and the low level evaluation predicates like +/3 etc. Every condition which yields an instantiation fault in non-coroutining mode now causes the predicates to delay until their arguments are sufficiently instantiated. For example:

X is 1 + 3 * Y.
where Y is an uninstantiated variable will generate an instantiation fault in non-coroutining mode. In coroutining mode the goal will delay and will be woken as soon as Y is bound. Refer to page [*] on how to switch on the coroutining mode.

Note that the predicates that delay are the low level evaluation predicates. In the above example the free variable Y causes the multiplication to delay and the unavailable result of the multiplication causes the addition to delay:

[eclipse 1]: X is 1 + 3 * Y.

X = X
Y = Y
 
Delayed goals:
         *(3, Y, _d142)
         +(1, _d142, X)
yes.
The comparison predicates behave in a similar way:
[eclipse 1]: 3 > Y + 1.

Y = Y

Delayed goals:
        +(Y, 1, _d138)
        3 > _d138
yes.


next up previous index
Next: Arrays and Global Variables Up: Arithmetic Previous: The Multi-Directional Predicates plus/3   Index

1999-08-06