Many wrote that the functional programming 'fold' is a good model for relational aggregate functions. I have a few difficulties with this:
1. fold doesn't offer any type of GROUP BY, which is an essential component of aggregation.
2. I don't believe fold can handle things like AVG() or STDDEV(). Can it? Conversely, fold can handle non-commutative and non-associative operators, which I don't believe can be used for aggregation.
3. fold is defined on sequences, not sets. This doesn't seem to be a problem until you think about cases where there a duplicates of the aggregated field. (For instance, there are 10 bags each weighing 5 lbs, and you want SUM(weight) - you need to project weight onto a collection which allows for 10 occurences, or define the aggregate function to work on the whole tuple somehow... I know a man named Krug worked out a formal theory for this...)