This Commented CUE demonstrates how to use the built-in functions list.Avg, list.Max, list.Min, and list.Sum to calculate various simple summary statistics for a list of numbers including the list’s arithmetic mean, its maximum and minimum values, and the sum of its values.

file.cue
package example

import "list"

sum:  list.Sum(_data)
min:  list.Min(_data)
max:  list.Max(_data)
mean: list.Avg(_data)

_data: [
	-0.00000000001,
	0,
	1,
	5,
	10,
	42,
	-999,
]
TERMINAL
$ cue eval
sum:  -941.00000000001
min:  -999
max:  42
mean: -134.4285714285728571428571428571429
  • The list built-in package