``Parallel or'' is a classic idiom of parallel programming. The ``parallel or'' operation executes two
expressions F and G in parallel, each of which may publish a single boolean,
and returns the disjunction of their publications as soon as possible.
If one of the expressions publishes true, then the disjunction is true,
so it is not necessary to wait for the other expression to publish a value.
This holds even if one of the expressions is silent.
The ``parallel or'' of expressions F and G may be expressed in Orc as follows:
val result = val a = F val b = G Ift(a) >> true | Ift(b) >> true | (a || b) result
The expression (a || b) waits for both a and b to become
available and then publishes their disjunction. However if either a or
b is true we can publish true immediately regardless of whether the
other variable is available. Therefore we run Ift(a) >> true and Ift(b) >> true
in parallel to wait for either variable to become true and immediately
publish the result true. Since more than one of these expressions may
publish true, the surrounding val is necessary to select and
publish only the first result.