Next: , Previous: , Up: Expressions   [Contents][Index]


4.2.3 Aggregate expressions

Aggregate expressions ( <aggr_expr>s) are currently used exclusively by the LOGS statement. They represent an expression with a given function applied to the aggregate of all (dynamic) instances of that expression. <aggr_expr>s take one of four forms:

<aggr_expr> ::= [ EACH] <expr>
| THE <expr>
| THE <aggr_func> [ AND THE <aggr_func>]* [ OF [ THE]] <expr>
| A HISTOGRAM OF [ THE] <expr>

(In the above, <expr> refers to an arithmetic expression defined in Arithmetic expressions and <aggr_func> refers to one of the functions defined in Aggregate functions.)

The first form does not summarize <expr>; every individual instance of <expr> is utilized. The second form asserts that <expr> is a constant (i.e., all values are identical) and utilizes that constant.13 The third form applies each <aggr_func> to the set of all values of <expr> and utilizes the result of that function. The fourth form produces a histogram of all values of <expr>, i.e., a list of {unique value, tally} pairs, sorted by unique value.


Footnotes

(13)

The program aborts with a run-time error if <expr> is not a constant.

Scott Pakin, pakin@lanl.gov