Values average (aka. arithmetic mean)

var c = new Counter[String].from(["a", "a", "b", "b", "b", "c"])
assert c.avg == 2.0

Property definitions

counter $ Counter :: avg
	# 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
lib/counter/counter.nit:238,2--247,4