mean-sugar
Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.
Syntax:
Category#
reduction
Related#
None.
Examples#
radix/corpus/reference/concept/mean-sugar/mean-sugar.fab (canonical · concept)#
main {
let list<f32> flat ← [3.0, 1.0, 3.0, 2.0]
let tf32[4] a ← flat ↦ tensor<f32, [4]>
let f32 viaSum ← (reduce via sum from a) / 4.0
print a.mean()
print viaSum
let list<f32> emptyData ← []
let tf32[0] e ← emptyData ↦ tensor<f32, [0]>
print e.mean()
}Expected output:
2.25
2.25
NaN