aboutsummaryrefslogtreecommitdiff
path: root/comparison/SML/qsort-800000.sml
diff options
context:
space:
mode:
Diffstat (limited to 'comparison/SML/qsort-800000.sml')
-rw-r--r--comparison/SML/qsort-800000.sml20
1 files changed, 17 insertions, 3 deletions
diff --git a/comparison/SML/qsort-800000.sml b/comparison/SML/qsort-800000.sml
index e27af56..212029d 100644
--- a/comparison/SML/qsort-800000.sml
+++ b/comparison/SML/qsort-800000.sml
@@ -15,7 +15,7 @@ fun quicksort nil = nil
end;
-(* mkRandList *)
+(* Creates a random list *)
local
val nextInt = Random.randRange(1,10000);
val r = Random.rand(1,1);
@@ -23,5 +23,19 @@ in
fun mkRandList 0 = []
| mkRandList n = (nextInt r)::(mkRandList (n-1))
end;
-
-quicksort (mkRandList 800000);
+
+
+(* Validation checks *)
+fun validation [] = true
+ | validation (x::xs) =
+ let fun validation_cons x [] = true
+ | validation_cons x (y::ys) =
+ if x<=y then validation_cons y ys
+ else false
+ in
+ validation_cons x xs
+ end;
+
+
+(* Main *)
+validation(quicksort(mkRandList 800000));