Some sorting algorithms implemented using functional programming