Conditionals

Suppose we have a condition represented by a source S and two paths Q' and Q''. Consider the path
    \? {S \! Q'; \! Q";}

If the result of evaluating S is an empty expression, the path Q' is evaluated and the value returned is taken to be the result of the whole construct. Otherwise, if the result of evaluating S is a failure, the path Q'' is evaluated and the value returned is taken to be the result of the whole construct.

Notice should be taken of the use of cuts \! . They prove to be essential in cases where the evaluation of Q' or Q'' fails. Let us try removing the cuts, and consider the path thus obtained:
    { S, Q'; Q";}

Now, if the condition S is satisfied, the path Q' is evaluated. Suppose the evaluation of Q' fails. Then, instead of being returned as the result of the whole construct, the failure is caught, which causes the evaluation of the path Q''. But this, certainly, was not our intention! Thus the first cut is necessary to prevent the control from "jumping" to the next path in the alternative.

Now, let us consider the case where the condition is not satisfied, i.e. the evaluation of S fails. Then the failure is caught, which causes the evaluation of the path Q''. Suppose that the evaluation of Q'' fails. Then the failure is caught and an attempt is made to evaluate the next path in the alternative. But there is no such path! Hence, an error is generated, which, again, was not our intention!

Nevertheless, in some cases, the cuts can be omitted. Thus an alternative of the form
    \? {S \! = Q'; \! = Q";}
can always be, and usually is, rewritten as
    { S = Q'; = Q";}

As an example let us consider the function MinE, which takes two ground expressions Ge1 and Ge2 as arguments, and returns either Ge1 or Ge2. Namely, if Ge1 precedes Ge2, the result is Ge1, otherwise the result is Ge2.

$func MinE (eX)(eY) = e.MinXY;

MinE  (eX)(eY) =
  {
  <Lt (eX)(eY)>
    = eX;
    = eY;
  };
Now consider the case where a condition is represented by a path Q, and a path Q' must be evaluated if the condition is not satisfied, whereas a path Q'' must be evaluated if the condition is not satisfied. This case can be reduced to the above by enclosing the condition Q in curly braces thereby making the path Q into the source \{ Q; } . Now the conditional can be written as follows:
    \? { \{Q;} \! Q'; \! Q";}