This version is out of date, covering development from v9.5.0 to v9.7.3. It is maintained here only for inbound reference links from elsewhere. It is no longer actively updated.

Jump to the current version of aTbRef

Tinderbox v9 Icon

List/Set.sum()


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Last Altered: 

 Function  [other Function type actions]

 Item  [operators of similar scope]

 Mathematical  [other Mathematical operators]

 Baseline

 As at baseline


Syntax note: Operators without any defined mandatory arguments may omit their empty closing parentheses


List/Set.sum()

List/Set.sum

For Lists or sets of Number-type data, this adds up lists of numbers. If $MyList is 1;2;3;4, then for:

$MyNumber = $MyList.sum; 

$MyNumber is 10, i.e. 1+2+3+4.

Non-numerical items

The general expectation is this operator is used for number-only lists. Non-numerical list items are ignored:

"2; 4; 6; 12".sum gives 24 

"2; 8bees; 4; bee; 6; bee5; 12; bee2bee" also gives 24 

However, be aware of note this edge case;

2; 8 bees; 4; bee; 6; bee 5; 12; bee 2 bee gives 32 

Here, the original result of 24 is supplemented by the opening 8 from '8 bees' and the trailing 5 from 'bee5' to give 32. But, the 2 entirely within 'bee 2 bee' is not counted.