From 8c7809d024e85d0a8acfb794a4db41b0e4bc13e6 Mon Sep 17 00:00:00 2001 From: Shinya Sato Date: Mon, 2 May 2022 09:49:01 +0900 Subject: v0.8.2-1 --- comparison/OCaml/bsort40000.ml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'comparison/OCaml/bsort40000.ml') diff --git a/comparison/OCaml/bsort40000.ml b/comparison/OCaml/bsort40000.ml index 2a06e85..80c222e 100644 --- a/comparison/OCaml/bsort40000.ml +++ b/comparison/OCaml/bsort40000.ml @@ -1,3 +1,5 @@ +open Format + let rec bs (alist : int list) n = match alist with (x::y::ys) -> @@ -11,9 +13,12 @@ let rec go xs n = 0 -> xs | n -> go (bs xs n) (n-1);; -let bsort xs = go xs (List.length(xs) - 1);; - +let bsort alist = + match alist with + [] -> [] + | xs -> go xs (List.length(xs) - 1);; + let rec mkRandList n = match n with 0 -> [] @@ -31,5 +36,4 @@ let rec validation alist = | x::xs -> validation_cons x xs;; -let main = validation (bsort (mkRandList 40000));; - +let () = print_bool (validation (bsort (mkRandList 40000)));; -- cgit v1.2.3