SML implementation of a merge sort