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/OCaml/isort40000.ml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'comparison/OCaml/isort40000.ml') diff --git a/comparison/OCaml/isort40000.ml b/comparison/OCaml/isort40000.ml index 686a7f6..92e127d 100644 --- a/comparison/OCaml/isort40000.ml +++ b/comparison/OCaml/isort40000.ml @@ -1,11 +1,3 @@ -(* -let rec insert x ylist = - match ylist with - [] -> [x] - | y::ys when x<=y -> x::y::ys - | y::ys -> y::(insert x ys);; -*) - let rec insert x ylist = match ylist with [] -> [x] @@ -26,5 +18,17 @@ let rec mkRandList n = 0 -> [] | n -> (Random.int 10000)::(mkRandList (n-1));; -let main = isort (mkRandList 40000);; + +let rec validation alist = + let rec validation_cons x blist = + match blist with + [] -> true + | y::ys -> if x<=y then (validation_cons y ys) else false + in + match alist with + [] -> true + | x::xs -> validation_cons x xs;; + + +let main = validation(isort (mkRandList 40000));; -- cgit v1.2.3