insert :: Ord a => a -> [a] -> [a] insert x [] = [x] insert x (y:ys) | x < y = x:y:ys | otherwise = y:(insert x ys) isort :: Ord a => [a] -> [a] isort [] = [] isort (x:xs) = insert x (isort xs)
使用示例:
> isort [5,4,3,2,1]
结果:
[1,2,3,4,5]
友情链接: json在线解析 通晓查询 糯晒黄历 姓名打分 风车动漫