blob: 58e0301573b830996e8e5f8c31809225839b50a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import Data.Vect
insert : Ord elem =>
(x : elem) -> (xsSorted : Vect len elem) -> Vect (S len) elem
insert x [] = [x]
insert x (y :: xs) = case x < y of
True => x :: y :: xs
False => y :: insert x xs
insSort : Ord elem => Vect n elem -> Vect n elem
insSort [] = []
insSort (x :: xs) = let xsSorted = insSort xs in
insert x xsSorted
|