solved problem 001 in Standard ML