list.sorted

sorted r l is the same as pairwise r l, preferred in the case that r is a < or -like relation (transitive and antisymmetric or asymmetric)

list.ordered_insert

ordered_insert a l inserts a into l at such that ordered_insert a l is sorted if l is.

list.insertion_sort

insertion_sort l returns l sorted using the insertion sort algorithm.

list.split

Split l into two lists of approximately equal length.

split [1, 2, 3, 4, 5] = ([1, 3, 5], [2, 4])

list.merge

Merge two sorted lists into one in linear time.

merge [1, 2, 4, 5] [0, 1, 3, 4] = [0, 1, 1, 2, 3, 4, 4, 5]

list.merge_sort

Implementation of a merge sort algorithm to sort a list.