I'm not sure that count is useful here - the function that the caller passes in can close over an external variable instead.