Root mean square
func rms(a) {
sqrt(a.map{.**2}.sum / a.len)
}
say rms(1..10)Using hyper operators, we can write it as:
func rms(a) { a »**» 2 «+» / a.len -> sqrt }Output:
6.20483682299542829806662097772473784992796529536Last updated
Was this helpful?