$ afl >> len [] == 0 >> len (a : rest) == 1 + len rest >> len [2,4, 6, 4, 1] 5 >> split L == splithelper L [] [] >> splithelper [] A B == [A, B] >> splithelper (x1: x2: rest) A B == splithelper rest (x1 : A) (x2 : B) >> splithelper [x1] A B == [(x1 : A), B] >> >> split [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] [[13, 11, 9, 7, 5, 3, 1], [12, 10, 8, 6, 4, 2]] >> reverse L == rev L [] >> rev [] A == A >> rev (x1 : rest) A == rev rest (x1 : A) >> reverse [1, 2, 3, 4, 5, 6, 7] [7, 6, 5, 4, 3, 2, 1] >> applist F [] == [] >> applist F (hd : rest) == (F hd) : (applist F rest) >> applist reverse (split [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]) [[1, 3, 5, 7, 9, 11, 13], [2, 4, 6, 8, 10, 12]] >> merge [] X == X >> merge X [] == X >> merge (a1 : resta) (b1 : restb) == \ > a1 : merge resta (b1 : restb) \ > <| a1 < b1 |> \ > b1 : merge (a1 : resta) restb >> merge [2, 4, 5, 7, 8, 10, 14] [1, 3, 4, 6, 8, 11, 15, 18, 19] [1, 2, 3, 4, 4, 5, 6, 7, 8, 8, 10, 11, 14, 15, 18, 19] >> msort [] == [] >> msort [x] == [x] >> msort L == mhelper L [] [] >> mhelper [] A B == merge (msort A) (msort B) >> mhelper [x1] A B == mhelper [] (x1 : A) B >> mhelper (x1 : x2 : rest) A B == mhelper rest (x1 : A) (x2 : B) >> msort [2, 8, 4, 1, 7 ,9, 5, 0, 6] [0, 1, 2, 4, 5, 6, 7, 8, 9] >> ins x [] == [x] >> ins x (a : rest) == x : a : rest \ > <| x < a |> \ > a : ins x rest >> ins 5 [2, 3, 6, 8, 9] [2, 3, 5, 6, 8, 9] >> inssort [] == [] >> inssort (a : rest) == ins a (inssort rest) >> inssort [2, 8, 4, 1, 7 ,9, 5, 0, 6] [0, 1, 2, 4, 5, 6, 7, 8, 9] >> intsfrom n == n : intsfrom (n+1) >> first 0 L == [] >> first n (a : rest) == a : first (n - 1) rest >> intsbetween a b == first (b - a + 1) (intsfrom a) >> intsbetween 10 20 [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] >> :exit $