up: BOX     index Zimbu documentation

PIECE BOX.Average<Titem> @public

summary

     

Provide average() and total() for any Box that has $Iterator() and where the item type can be added up.

$average() Titem @public  Return the average value of all items in the Box.
$total() Titem @public  Return the total value of all items in the Box.
 

members (alphabetically)

     

FUNC $average() Titem @public

     

Return the average value of all items in the Box.

The value will be wrong when total() does not fit in Titem.

The value will be rounded. E.g. a list [4, 5, 5] will have an average of 5.

When the Box is empty returns NIL/zero/false.

FUNC $total() Titem @public

     

Return the total value of all items in the Box.

The value will be wrong when it does not fit in Titem.

When the Box is empty returns NIL/zero/false.

license

      Copyright 2013 Bram Moolenaar All Rights Reserved.

      Licensed under the Apache License, Version 2.0. See the LICENSE file or obtain a copy at: http://www.apache.org/licenses/LICENSE-2.0