Avg

Average

Signature

avg(expr: AttrName|(Tuple->Numeric)) -> Aggregator

Examples

avg(:qty)
avg{|t| t.qty * t.price }
avg(->(t){ t.qty * t.price })

Description

Aggregates through v1 + v2 + ... + vn / n.

Implementation notes

This aggregate function should only be used with numeric types. As of current Alf version, it does not aggregate empty sets correctly on non-numeric data types.