Quellcode durchsuchen

Create a sort function by extraction

DricomDragon vor 5 Jahren
Ursprung
Commit
0dd603878b
1 geänderte Dateien mit 5 neuen und 0 gelöschten Zeilen
  1. 5 0
      listfct.hs

+ 5 - 0
listfct.hs

@@ -16,3 +16,8 @@ mymaximum l = mymaximumof l 0
 mymaximumof l x = case l of
 	[] -> x
 	y:ys -> if y > x then mymaximumof ys y else mymaximumof ys x
+
+-- Sort the list
+trimax l = if l == []
+	then []
+	else let y = mymaximum l in y:(trimax (mydelete l y))