From eddac153a064648bee2aef6fb733ab6820bb96c3 Mon Sep 17 00:00:00 2001 From: Shinya Sato Date: Thu, 28 Apr 2022 21:41:58 +0900 Subject: v0.8.2 --- comparison/SML/isort-40000.sml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'comparison/SML/isort-40000.sml') diff --git a/comparison/SML/isort-40000.sml b/comparison/SML/isort-40000.sml index a851dbd..9fbaf09 100644 --- a/comparison/SML/isort-40000.sml +++ b/comparison/SML/isort-40000.sml @@ -8,7 +8,8 @@ fun insertsort [] = [] in insert(x, insertsort xs) end; -(* mkRandList *) + +(* Creates a random list *) local val nextInt = Random.randRange(1,10000); val r = Random.rand(1,1); @@ -16,5 +17,19 @@ in fun mkRandList 0 = [] | mkRandList n = (nextInt r)::(mkRandList (n-1)) end; - -insertsort (mkRandList 40000); \ No newline at end of file + + +(* 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(insertsort(mkRandList 40000)); -- cgit v1.2.3