14 lines
261 B
Text
14 lines
261 B
Text
import morfa.base;
|
|
import morfa.functional.base;
|
|
|
|
template <TRange>
|
|
func rms(d: TRange): float
|
|
{
|
|
var count = 1;
|
|
return sqrt(reduce( (a: float, b: float) { count += 1; return a + b * b; }, d) / count);
|
|
}
|
|
|
|
func main(): void
|
|
{
|
|
println(rms(1 .. 11));
|
|
}
|