cfengine/core — pull request #1239 by tzz (2014-01-05 12:33:53+00:00)
Title: list folding utility functions: min, max, mean, variance

General list utility functions: `min`, `max`, `mean`, `variance`. Acceptance tests included.

`min` and `max` take the same "sort mode" argument as the `sort` function.

The `length` function was refactored to use the same general list-folding mechanism.

The variance is computed with Welford's one-pass algorithm to avoid traversing the list twice. This also provides the mean.

There is no need for a standard deviation function, it's just `sqrt(variance)` as shown in the acceptance test.

There is no need for a `range` function, just use `eval("$(max)-$(min)", "math", "infix")`.

Documentation and examples will be provided when and if this PR is accepted.