Re: Evaluation of aggregates

On 20 Sep 2010, at 15:23, Andy Seaborne wrote:

> 
> 
> On 20/09/10 11:30, Axel Polleres wrote:
> >> >  Just define:
> >> >  Sum(S) = op:numeric-add(S0, Sum(S1..n)) when|S|  >  1 if S0 is a number
> >> >  Sum(S) = op:numeric-add(0, Sum(S1..n)) when|S|  >  1 if S0 is not a number
> > is not as straightforward as Flatten op:numeric-add, but could be an option.
> >
> 
> I don't understand that. The flatten operation is independent of the
> specific aggregation - it doesn't remove non-numbers:

yes, that's what meant to say, the current definition just via flatten and 
then "delegating" directly to op:numeric-add doesn't cover that aspect yet. 
what you write here should work, but it is an extension of the current 
Definition of Sum

Anyways, don't we need to extend Definition of Sum also to cover errors, 
or do you intend this covered by "if S0 is not a number" ?

> 
> [[
> Definition: Flatten
> 
> The Flatten(M) function takes a multiset of lists, M {(L1, L2, ...),
> ...}, and returns the multiset given by the multiset union of { Li | L
> in M } for all i in L.
> ]]
> 
> Could be changed to take a condition on the members produced.
> 
> Avg() works if Sum() does.

agreed.

Axel


> 
>         Andy
> 

Received on Monday, 20 September 2010 13:30:49 UTC