Forester 4.2 › New query language › Unions and intersections of families of queries [00X1]

A further primitive query-former is the union or intersection of a certain family of queries indexed in the results of a fixed query. These are written as follows:

\query/union-fam{q}{qfam}
\query/isect-fam{q}{qfam}

In the above, q is a query expression and qfam is a first-class function that takes an address and returns a query expression. There are a couple built-in instantiations of \query/union-fam and \query/isect-fam for the specific case where qfam is a family of relational queries; for example:

\query/union-fam-rel{q}{mode}{polarity}{rel}

is equivalent to the following more verbose code:

\query/union-fam{q}{
 \fun[x]{
  \query/rel{mode}{pol}{\x}
 }
}

In the future, the support for query-indexed families of queries might be generalised to allow arbitrary queries in the components rather than only relational ones. The current version of the feature should be viewed as somewhat provisional.

Context

Forester 4.2 › New query language [00WS]

Related

Forester 4.2 › First-class functions and lazy arguments [00YF]