#
Chapter 8

Ex 8.1
  `MODE BINT = UNION(BOOL,INT)`
Ex 8.2
  `BINT b = TRUE`
Ex 8.3
  One of the constituent modes of the union is firmly-related to the united mode. In other words, in a firm context, `REF UB` can be dereferenced to `UB`.
Ex 8.4
  `UNION(INT,[]INT,[,]INT) mint`

Ex 8.5
  The first parameter is deprocedured to mode `CHAR` before being united. The second is dereferenced to mode `[]CHAR` and then united. The two values of the united mode are regarded as a row-display and the procedure is then called. The second parameter is an example of an anonymous name--no identifier is attached.
Ex 8.6

         PROC ucis=(CHAR ch,[]CHAR s)
                        UNION(INT,VOID):

         IF   INT p = ch FIND s;  p >= LWB s
         THEN p
         ELSE EMPTY
         FI

Ex 8.7

         PROC p = (MIRC m)IRC:
         CASE m IN
            ([]INT i): (INT sum:=0;
                        FOR j FROM LWB i TO UPB i
                        DO sum+:=i[j] OD;
                        sum),
            ([]REAL r):(REAL sum:=0;
                        FOR j FROM LWB r TO UPB r
                        DO sum+:=r[j] OD;
                        sum),
            ([]COMPL c):(COMPL sum:=0;
                        FOR j FROM LWB c TO UPB c
                        DO sum+:=c[j] OD;
                        sum)
         ESAC

Ex 8.8

         OP * = (IRC a,b)IRC:
         CASE a IN
            (INT i):  CASE b IN
                         (INT j):   i*j,
                         (REAL j):  i*j,
                         (COMPL j): i*j
                      ESAC,
            (REAL i): CASE b IN
                         (INT j):   i*j,
                         (REAL j):  i*j,
                         (COMPL j): i*j
                      ESAC,
            (COMPL i):CASE b IN
                         (INT j):   i*j,
                         (REAL j):  i*j,
                         (COMPL j): i*j
                      ESAC
         ESAC

Ex 8.9
  `MODE CRIB = UNION(CHAR,REAL,INT,BOOL)`
Ex 8.10

         OP UABS = (CRIB c)UNION(INT,REAL):
         CASE c IN
            (CHAR a):   ABS a,
            (REAL a):   ABS a,
            (INT a):    ABS a,
            (BOOL a):   ABS a
         ESAC

Ex 8.11
  `UABS "c"; UABS -4.0; UABS -3; UABS TRUE`