Einfügen (in monotone Liste)
insert :: Int -> [Int] -> [Int] insert x ys = case ys of [] -> [x] ; y : ys' -> if x < y then .. else ..Sortieren durch Einfügen:
sort :: [Int] -> [Int] sort xs = foldr insert [] xsEinfügen/Sortieren für beliebige Typen:
insert :: (a->a-> Bool) -> a -> [a] -> [a] insert lt x ys = ... if lt x y then ...