counter :: Counter :: avg
var c = new Counter[String].from(["a", "a", "b", "b", "b", "c"]) assert c.avg == 2.0
# Values average (aka. arithmetic mean) # # ~~~ # var c = new Counter[String].from(["a", "a", "b", "b", "b", "c"]) # assert c.avg == 2.0 # ~~~ fun avg: Float do if values.is_empty then return 0.0 return (sum / values.length).to_f end