All of the following information is based on go version go1.17.1 darwin/amd64
.
GOOS | Out of the Box |
---|---|
aix |
✅ |
android |
✅ |
extension Collection where Element == Int, Index == Int { | |
/// Calculates a moving average. | |
/// - Parameter period: the period to calculate averages for. | |
/// - Warning: the supplied `period` must be larger than 1. | |
/// - Warning: the supplied `period` should not exceed the collection's `count`. | |
/// - Returns: a dictionary of indexes and averages. | |
func movingAverage(period: Int) -> [Int: Float] { | |
precondition(period > 1) | |
precondition(count > period) |