erlang implementation on holes problem