Function: toMean()
toMean():
Reducer
<number
,number
>
Returns a Reducer that computes the mean of the numbers it receives.
Use when composing reducers. Prefer mean, meanAsync, and meanConcur for direct use on iterables.
Returns
Reducer
<number
, number
>
Example
console.log(
pipe(
[`sloth`, `more sloth`, `sleep`, `some sloth`],
map(string => [string.length, [...string].filter(c => c === `o`).length]),
reduce(toGrouped(toMean(), toMap())),
),
)
//=> Map(2) { 5 => 0.5, 10 => 2 }