completed problems 2a thu 2f for hw2.sml, with tests