A chi squared test written in Erlang